public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] elf_fdpic_core_dump: don't take tasklist_lock
@ 2006-08-13 20:11 Oleg Nesterov
  2006-08-14 11:30 ` David Howells
  0 siblings, 1 reply; 2+ messages in thread
From: Oleg Nesterov @ 2006-08-13 20:11 UTC (permalink / raw)
  To: Andrew Morton, David Howells; +Cc: linux-kernel, Eric W. Biederman

do_each_thread() is rcu-safe, and all tasks which use this ->mm must
sleep in wait_for_completion(&mm->core_done) at this point, so we can
use RCU locks.

Also, remove unneeded INIT_LIST_HEAD(new) before list_add(new, head).

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>

--- 2.6.18-rc3/fs/binfmt_elf_fdpic.c~fdpic	2006-07-16 01:53:08.000000000 +0400
+++ 2.6.18-rc3/fs/binfmt_elf_fdpic.c	2006-08-14 00:05:27.000000000 +0400
@@ -1597,20 +1597,19 @@ static int elf_fdpic_core_dump(long sign
 
 	if (signr) {
 		struct elf_thread_status *tmp;
-		read_lock(&tasklist_lock);
+		rcu_read_lock();
 		do_each_thread(g,p)
 			if (current->mm == p->mm && current != p) {
 				tmp = kzalloc(sizeof(*tmp), GFP_ATOMIC);
 				if (!tmp) {
-					read_unlock(&tasklist_lock);
+					rcu_read_unlock();
 					goto cleanup;
 				}
-				INIT_LIST_HEAD(&tmp->list);
 				tmp->thread = p;
 				list_add(&tmp->list, &thread_list);
 			}
 		while_each_thread(g,p);
-		read_unlock(&tasklist_lock);
+		rcu_read_unlock();
 		list_for_each(t, &thread_list) {
 			struct elf_thread_status *tmp;
 			int sz;


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-08-14 11:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-13 20:11 [PATCH] elf_fdpic_core_dump: don't take tasklist_lock Oleg Nesterov
2006-08-14 11:30 ` David Howells

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox