mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 11:46:19 +00:00
[PATCH] elf_fdpic_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> Acked-By: David Howells <dhowells@redhat.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
486ccb05fd
commit
bce9a234ce
1 changed files with 3 additions and 4 deletions
|
@ -1597,20 +1597,19 @@ static int elf_fdpic_core_dump(long signr, struct pt_regs *regs,
|
||||||
|
|
||||||
if (signr) {
|
if (signr) {
|
||||||
struct elf_thread_status *tmp;
|
struct elf_thread_status *tmp;
|
||||||
read_lock(&tasklist_lock);
|
rcu_read_lock();
|
||||||
do_each_thread(g,p)
|
do_each_thread(g,p)
|
||||||
if (current->mm == p->mm && current != p) {
|
if (current->mm == p->mm && current != p) {
|
||||||
tmp = kzalloc(sizeof(*tmp), GFP_ATOMIC);
|
tmp = kzalloc(sizeof(*tmp), GFP_ATOMIC);
|
||||||
if (!tmp) {
|
if (!tmp) {
|
||||||
read_unlock(&tasklist_lock);
|
rcu_read_unlock();
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
INIT_LIST_HEAD(&tmp->list);
|
|
||||||
tmp->thread = p;
|
tmp->thread = p;
|
||||||
list_add(&tmp->list, &thread_list);
|
list_add(&tmp->list, &thread_list);
|
||||||
}
|
}
|
||||||
while_each_thread(g,p);
|
while_each_thread(g,p);
|
||||||
read_unlock(&tasklist_lock);
|
rcu_read_unlock();
|
||||||
list_for_each(t, &thread_list) {
|
list_for_each(t, &thread_list) {
|
||||||
struct elf_thread_status *tmp;
|
struct elf_thread_status *tmp;
|
||||||
int sz;
|
int sz;
|
||||||
|
|
Loading…
Reference in a new issue