diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-05-17 11:24:08 +0200 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-05-17 11:26:57 +0200 |
commit | 0203026b58b4299ba7281c0b4b417207c1f05d0e (patch) | |
tree | 02c9f3486544b0f7db1922f05cf12e6480eaf95f /kernel | |
parent | perf_counter: Fix counter inheritance (diff) | |
download | linux-0203026b58b4299ba7281c0b4b417207c1f05d0e.tar.xz linux-0203026b58b4299ba7281c0b4b417207c1f05d0e.zip |
perf_counter: fix threaded task exit
Flushing counters in __exit_signal() with irqs disabled is not
a good idea as perf_counter_exit_task() acquires mutexes. So
flush it before acquiring the tasklist lock.
(Note, we still need a fix for when the PID has been unhashed.)
[ Impact: fix crash with inherited counters ]
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Srivatsa Vaddagiri <vatsa@in.ibm.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/exit.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/kernel/exit.c b/kernel/exit.c index 16d74f13a3e7..73affd35e76d 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -128,12 +128,6 @@ static void __exit_signal(struct task_struct *tsk) sig = NULL; /* Marker for below. */ } - /* - * Flush inherited counters to the parent - before the parent - * gets woken up by child-exit notifications. - */ - perf_counter_exit_task(tsk); - __unhash_process(tsk); /* @@ -183,6 +177,13 @@ repeat: atomic_dec(&__task_cred(p)->user->processes); proc_flush_task(p); + + /* + * Flush inherited counters to the parent - before the parent + * gets woken up by child-exit notifications. + */ + perf_counter_exit_task(p); + write_lock_irq(&tasklist_lock); tracehook_finish_release_task(p); __exit_signal(p); |