summaryrefslogtreecommitdiffstats
path: root/include/linux/sched.h
diff options
context:
space:
mode:
authorEric W. Biederman2006-04-19 07:20:16 +0200
committerLinus Torvalds2006-04-19 18:13:49 +0200
commit5e85d4abe3f43bb5362f384bab0e20ef082ce0b5 (patch)
treecd3a29086e5274fd08bc8d22d15568deab144755 /include/linux/sched.h
parent[PATCH] uml: make 64-bit COW files compatible with 32-bit ones (diff)
downloadkernel-qcow2-linux-5e85d4abe3f43bb5362f384bab0e20ef082ce0b5.tar.gz
kernel-qcow2-linux-5e85d4abe3f43bb5362f384bab0e20ef082ce0b5.tar.xz
kernel-qcow2-linux-5e85d4abe3f43bb5362f384bab0e20ef082ce0b5.zip
[PATCH] task: Make task list manipulations RCU safe
While we can currently walk through thread groups, process groups, and sessions with just the rcu_read_lock, this opens the door to walking the entire task list. We already have all of the other RCU guarantees so there is no cost in doing this, this should be enough so that proc can stop taking the tasklist lock during readdir. prev_task was killed because it has no users, and using it will miss new tasks when doing an rcu traversal. 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 'include/linux/sched.h')
-rw-r--r--include/linux/sched.h3
1 files changed, 1 insertions, 2 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h
index b7d31e2e1729..29b7d4f87d20 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1192,8 +1192,7 @@ extern void wait_task_inactive(task_t * p);
#define remove_parent(p) list_del_init(&(p)->sibling)
#define add_parent(p) list_add_tail(&(p)->sibling,&(p)->parent->children)
-#define next_task(p) list_entry((p)->tasks.next, struct task_struct, tasks)
-#define prev_task(p) list_entry((p)->tasks.prev, struct task_struct, tasks)
+#define next_task(p) list_entry(rcu_dereference((p)->tasks.next), struct task_struct, tasks)
#define for_each_process(p) \
for (p = &init_task ; (p = next_task(p)) != &init_task ; )