From: Eric W. Biederman This is just like my previous removal of tasklist_lock from first_tgid, and next_tgid. It simply had to wait until it was rcu safe to walk the thread list. This should be the last instance of the tasklist_lock in proc. So user processes should not be able to influence the tasklist lock hold times. Signed-off-by: Eric W. Biederman Signed-off-by: Andrew Morton --- fs/proc/base.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff -puN fs/proc/base.c~proc-remove-tasklist_lock-from-proc_task_readdir fs/proc/base.c --- devel/fs/proc/base.c~proc-remove-tasklist_lock-from-proc_task_readdir 2006-06-09 15:22:35.000000000 -0700 +++ devel-akpm/fs/proc/base.c 2006-06-09 15:22:35.000000000 -0700 @@ -2218,11 +2218,12 @@ int proc_pid_readdir(struct file * filp, * In the case of a seek we start with the leader and walk nr * threads past it. */ -static struct task_struct *first_tid(struct task_struct *leader, int tid, int nr) +static struct task_struct *first_tid(struct task_struct *leader, + int tid, int nr) { struct task_struct *pos = NULL; - read_lock(&tasklist_lock); + rcu_read_lock(); /* Attempt to start with the pid of a thread */ if (tid && (nr > 0)) { pos = find_task_by_pid(tid); @@ -2252,7 +2253,7 @@ static struct task_struct *first_tid(str } pos = NULL; done: - read_unlock(&tasklist_lock); + rcu_read_unlock(); return pos; } @@ -2265,7 +2266,7 @@ done: static struct task_struct *next_tid(struct task_struct *start) { struct task_struct *pos; - read_lock(&tasklist_lock); + rcu_read_lock(); pos = start; if (pid_alive(start)) pos = next_thread(start); @@ -2273,7 +2274,7 @@ static struct task_struct *next_tid(stru get_task_struct(pos); else pos = NULL; - read_unlock(&tasklist_lock); + rcu_read_unlock(); put_task_struct(start); return pos; } _