diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2006-06-26 03:25:51 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-26 12:58:25 -0400 |
commit | 454cc105ef690f2a0ba7c6b194d55666b4e918ce (patch) | |
tree | b3e4fef90f42ddd16afc324fcff6371e44f63255 /fs/proc/base.c | |
parent | 0bc58a910220be3446eedc8e77fd45c0a16d8f25 (diff) |
[PATCH] proc: Remove tasklist_lock from proc_pid_readdir
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>
Diffstat (limited to 'fs/proc/base.c')
-rw-r--r-- | fs/proc/base.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c index 2236f7d3878e..cc578a300a2b 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -2043,7 +2043,7 @@ out: | |||
2043 | static struct task_struct *first_tgid(int tgid, int nr) | 2043 | static struct task_struct *first_tgid(int tgid, int nr) |
2044 | { | 2044 | { |
2045 | struct task_struct *pos = NULL; | 2045 | struct task_struct *pos = NULL; |
2046 | read_lock(&tasklist_lock); | 2046 | rcu_read_lock(); |
2047 | if (tgid && nr) { | 2047 | if (tgid && nr) { |
2048 | pos = find_task_by_pid(tgid); | 2048 | pos = find_task_by_pid(tgid); |
2049 | if (pos && !thread_group_leader(pos)) | 2049 | if (pos && !thread_group_leader(pos)) |
@@ -2069,7 +2069,7 @@ static struct task_struct *first_tgid(int tgid, int nr) | |||
2069 | } | 2069 | } |
2070 | pos = NULL; | 2070 | pos = NULL; |
2071 | done: | 2071 | done: |
2072 | read_unlock(&tasklist_lock); | 2072 | rcu_read_unlock(); |
2073 | return pos; | 2073 | return pos; |
2074 | } | 2074 | } |
2075 | 2075 | ||
@@ -2082,7 +2082,7 @@ done: | |||
2082 | static struct task_struct *next_tgid(struct task_struct *start) | 2082 | static struct task_struct *next_tgid(struct task_struct *start) |
2083 | { | 2083 | { |
2084 | struct task_struct *pos; | 2084 | struct task_struct *pos; |
2085 | read_lock(&tasklist_lock); | 2085 | rcu_read_lock(); |
2086 | pos = start; | 2086 | pos = start; |
2087 | if (pid_alive(start)) | 2087 | if (pid_alive(start)) |
2088 | pos = next_task(start); | 2088 | pos = next_task(start); |
@@ -2092,7 +2092,7 @@ static struct task_struct *next_tgid(struct task_struct *start) | |||
2092 | } | 2092 | } |
2093 | pos = NULL; | 2093 | pos = NULL; |
2094 | done: | 2094 | done: |
2095 | read_unlock(&tasklist_lock); | 2095 | rcu_read_unlock(); |
2096 | put_task_struct(start); | 2096 | put_task_struct(start); |
2097 | return pos; | 2097 | return pos; |
2098 | } | 2098 | } |