aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@tv-sign.ru>2008-07-25 04:47:45 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-25 13:53:40 -0400
commit182c515fd2a942623aed4e4e0e0b37fe96571b05 (patch)
tree2b792a4efbb3577e90986ee92d7e1d5d708d0174 /fs
parent83914441f94c6f2cd468ca97365f6c34f418706e (diff)
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: Oleg Nesterov <oleg@tv-sign.ru> Acked-by: Roland McGrath <roland@redhat.com> Cc: David Howells <dhowells@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/binfmt_elf_fdpic.c29
1 files changed, 12 insertions, 17 deletions
diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c
index 71bcc4b4d088..1b59b1edf26d 100644
--- a/fs/binfmt_elf_fdpic.c
+++ b/fs/binfmt_elf_fdpic.c
@@ -1573,7 +1573,6 @@ static int elf_fdpic_core_dump(long signr, struct pt_regs *regs,
1573 struct memelfnote *notes = NULL; 1573 struct memelfnote *notes = NULL;
1574 struct elf_prstatus *prstatus = NULL; /* NT_PRSTATUS */ 1574 struct elf_prstatus *prstatus = NULL; /* NT_PRSTATUS */
1575 struct elf_prpsinfo *psinfo = NULL; /* NT_PRPSINFO */ 1575 struct elf_prpsinfo *psinfo = NULL; /* NT_PRPSINFO */
1576 struct task_struct *g, *p;
1577 LIST_HEAD(thread_list); 1576 LIST_HEAD(thread_list);
1578 struct list_head *t; 1577 struct list_head *t;
1579 elf_fpregset_t *fpu = NULL; 1578 elf_fpregset_t *fpu = NULL;
@@ -1622,23 +1621,19 @@ static int elf_fdpic_core_dump(long signr, struct pt_regs *regs,
1622#endif 1621#endif
1623 1622
1624 if (signr) { 1623 if (signr) {
1624 struct core_thread *ct;
1625 struct elf_thread_status *tmp; 1625 struct elf_thread_status *tmp;
1626 rcu_read_lock(); 1626
1627 do_each_thread(g,p) 1627 for (ct = current->mm->core_state->dumper.next;
1628 if (current->mm == p->mm && current != p) { 1628 ct; ct = ct->next) {
1629 if (p->flags & PF_KTHREAD) 1629 tmp = kzalloc(sizeof(*tmp), GFP_KERNEL);
1630 continue; 1630 if (!tmp)
1631 1631 goto cleanup;
1632 tmp = kzalloc(sizeof(*tmp), GFP_ATOMIC); 1632
1633 if (!tmp) { 1633 tmp->thread = ct->task;
1634 rcu_read_unlock(); 1634 list_add(&tmp->list, &thread_list);
1635 goto cleanup; 1635 }
1636 } 1636
1637 tmp->thread = p;
1638 list_add(&tmp->list, &thread_list);
1639 }
1640 while_each_thread(g,p);
1641 rcu_read_unlock();
1642 list_for_each(t, &thread_list) { 1637 list_for_each(t, &thread_list) {
1643 struct elf_thread_status *tmp; 1638 struct elf_thread_status *tmp;
1644 int sz; 1639 int sz;