Skip to content

Commit

Permalink
[PATCH] proc: Remove tasklist_lock from proc_pid_readdir
Browse files Browse the repository at this point in the history
We don't need the tasklist_lock to safely iterate through processes
anymore.

This depends on my previous to task patches that make get_task_struct rcu
safe, and that make next_task() rcu safe.  I haven't gotten
first_tid/next_tid yet only because next_thread is missing an
rcu_dereference.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Eric W. Biederman authored and Linus Torvalds committed Jun 26, 2006
1 parent 0bc58a9 commit 454cc10
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions fs/proc/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -2043,7 +2043,7 @@ static struct dentry *proc_task_lookup(struct inode *dir, struct dentry * dentry
static struct task_struct *first_tgid(int tgid, int nr)
{
struct task_struct *pos = NULL;
read_lock(&tasklist_lock);
rcu_read_lock();
if (tgid && nr) {
pos = find_task_by_pid(tgid);
if (pos && !thread_group_leader(pos))
Expand All @@ -2069,7 +2069,7 @@ static struct task_struct *first_tgid(int tgid, int nr)
}
pos = NULL;
done:
read_unlock(&tasklist_lock);
rcu_read_unlock();
return pos;
}

Expand All @@ -2082,7 +2082,7 @@ static struct task_struct *first_tgid(int tgid, int nr)
static struct task_struct *next_tgid(struct task_struct *start)
{
struct task_struct *pos;
read_lock(&tasklist_lock);
rcu_read_lock();
pos = start;
if (pid_alive(start))
pos = next_task(start);
Expand All @@ -2092,7 +2092,7 @@ static struct task_struct *next_tgid(struct task_struct *start)
}
pos = NULL;
done:
read_unlock(&tasklist_lock);
rcu_read_unlock();
put_task_struct(start);
return pos;
}
Expand Down

0 comments on commit 454cc10

Please sign in to comment.