提交 182c515f 编写于 作者: O Oleg Nesterov 提交者: Linus Torvalds

coredump: elf_fdpic_core_dump: use core_state->dumper list

Kill the nasty rcu_read_lock() + do_each_thread() loop, use the list
encoded in mm->core_state instead, s/GFP_ATOMIC/GFP_KERNEL/.

This patch allows futher cleanups in binfmt_elf_fdpic.c.
Signed-off-by: NOleg Nesterov <oleg@tv-sign.ru>
Acked-by: NRoland McGrath <roland@redhat.com>
Cc: David Howells <dhowells@redhat.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 83914441
...@@ -1573,7 +1573,6 @@ static int elf_fdpic_core_dump(long signr, struct pt_regs *regs, ...@@ -1573,7 +1573,6 @@ static int elf_fdpic_core_dump(long signr, struct pt_regs *regs,
struct memelfnote *notes = NULL; struct memelfnote *notes = NULL;
struct elf_prstatus *prstatus = NULL; /* NT_PRSTATUS */ struct elf_prstatus *prstatus = NULL; /* NT_PRSTATUS */
struct elf_prpsinfo *psinfo = NULL; /* NT_PRPSINFO */ struct elf_prpsinfo *psinfo = NULL; /* NT_PRPSINFO */
struct task_struct *g, *p;
LIST_HEAD(thread_list); LIST_HEAD(thread_list);
struct list_head *t; struct list_head *t;
elf_fpregset_t *fpu = NULL; elf_fpregset_t *fpu = NULL;
...@@ -1622,23 +1621,19 @@ static int elf_fdpic_core_dump(long signr, struct pt_regs *regs, ...@@ -1622,23 +1621,19 @@ static int elf_fdpic_core_dump(long signr, struct pt_regs *regs,
#endif #endif
if (signr) { if (signr) {
struct core_thread *ct;
struct elf_thread_status *tmp; struct elf_thread_status *tmp;
rcu_read_lock();
do_each_thread(g,p) for (ct = current->mm->core_state->dumper.next;
if (current->mm == p->mm && current != p) { ct; ct = ct->next) {
if (p->flags & PF_KTHREAD) tmp = kzalloc(sizeof(*tmp), GFP_KERNEL);
continue; if (!tmp)
goto cleanup;
tmp = kzalloc(sizeof(*tmp), GFP_ATOMIC);
if (!tmp) { tmp->thread = ct->task;
rcu_read_unlock(); list_add(&tmp->list, &thread_list);
goto cleanup; }
}
tmp->thread = p;
list_add(&tmp->list, &thread_list);
}
while_each_thread(g,p);
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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册