diff options
author | Oleg Nesterov <oleg@tv-sign.ru> | 2006-09-29 05:00:24 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-29 12:18:14 -0400 |
commit | 486ccb05fdbb7ca79784fdf0d07d2a86de48cf05 (patch) | |
tree | 9f53973acf7080790ec18984a9eb4a1005bb2875 | |
parent | b22b4cdd53f5e1ee9ef1ef7933ddb77065859d05 (diff) |
[PATCH] elf_core_dump: don't take tasklist_lock
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>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | fs/binfmt_elf.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index bb43da5cde5c..6eb48e1446ec 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c | |||
@@ -1479,20 +1479,19 @@ static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file) | |||
1479 | 1479 | ||
1480 | if (signr) { | 1480 | if (signr) { |
1481 | struct elf_thread_status *tmp; | 1481 | struct elf_thread_status *tmp; |
1482 | read_lock(&tasklist_lock); | 1482 | rcu_read_lock(); |
1483 | do_each_thread(g,p) | 1483 | do_each_thread(g,p) |
1484 | if (current->mm == p->mm && current != p) { | 1484 | if (current->mm == p->mm && current != p) { |
1485 | tmp = kzalloc(sizeof(*tmp), GFP_ATOMIC); | 1485 | tmp = kzalloc(sizeof(*tmp), GFP_ATOMIC); |
1486 | if (!tmp) { | 1486 | if (!tmp) { |
1487 | read_unlock(&tasklist_lock); | 1487 | rcu_read_unlock(); |
1488 | goto cleanup; | 1488 | goto cleanup; |
1489 | } | 1489 | } |
1490 | INIT_LIST_HEAD(&tmp->list); | ||
1491 | tmp->thread = p; | 1490 | tmp->thread = p; |
1492 | list_add(&tmp->list, &thread_list); | 1491 | list_add(&tmp->list, &thread_list); |
1493 | } | 1492 | } |
1494 | while_each_thread(g,p); | 1493 | while_each_thread(g,p); |
1495 | read_unlock(&tasklist_lock); | 1494 | rcu_read_unlock(); |
1496 | list_for_each(t, &thread_list) { | 1495 | list_for_each(t, &thread_list) { |
1497 | struct elf_thread_status *tmp; | 1496 | struct elf_thread_status *tmp; |
1498 | int sz; | 1497 | int sz; |