]> err.no Git - linux-2.6/commitdiff
[PATCH] proc: Remove tasklist_lock from proc_pid_readdir
authorEric W. Biederman <ebiederm@xmission.com>
Mon, 26 Jun 2006 07:25:51 +0000 (00:25 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Mon, 26 Jun 2006 16:58:25 +0000 (09:58 -0700)
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>
fs/proc/base.c

index 2236f7d3878ec3bbecb39ce6c57b731be62db2bd..cc578a300a2b668f47ad8709e12ee9fbb354f69c 100644 (file)
@@ -2043,7 +2043,7 @@ out:
 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))
@@ -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;
 }
 
@@ -2082,7 +2082,7 @@ done:
 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);
@@ -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;
 }