aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/exit.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-06-11 17:01:07 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-06-11 17:01:07 -0400
commit8a1ca8cedd108c8e76a6ab34079d0bbb4f244799 (patch)
tree636c715524f1718599209cc289908ea44b6cb859 /kernel/exit.c
parentb640f042faa2a2fad6464f259a8afec06e2f6386 (diff)
parent940010c5a314a7bd9b498593bc6ba1718ac5aec5 (diff)
Merge branch 'perfcounters-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'perfcounters-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (574 commits) perf_counter: Turn off by default perf_counter: Add counter->id to the throttle event perf_counter: Better align code perf_counter: Rename L2 to LL cache perf_counter: Standardize event names perf_counter: Rename enums perf_counter tools: Clean up u64 usage perf_counter: Rename perf_counter_limit sysctl perf_counter: More paranoia settings perf_counter: powerpc: Implement generalized cache events for POWER processors perf_counters: powerpc: Add support for POWER7 processors perf_counter: Accurate period data perf_counter: Introduce struct for sample data perf_counter tools: Normalize data using per sample period data perf_counter: Annotate exit ctx recursion perf_counter tools: Propagate signals properly perf_counter tools: Small frequency related fixes perf_counter: More aggressive frequency adjustment perf_counter/x86: Fix the model number of Intel Core2 processors perf_counter, x86: Correct some event and umask values for Intel processors ...
Diffstat (limited to 'kernel/exit.c')
-rw-r--r--kernel/exit.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/kernel/exit.c b/kernel/exit.c
index 51d1fe3fb7ad..b6c90b5ef509 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -48,6 +48,7 @@
48#include <linux/tracehook.h> 48#include <linux/tracehook.h>
49#include <linux/fs_struct.h> 49#include <linux/fs_struct.h>
50#include <linux/init_task.h> 50#include <linux/init_task.h>
51#include <linux/perf_counter.h>
51#include <trace/events/sched.h> 52#include <trace/events/sched.h>
52 53
53#include <asm/uaccess.h> 54#include <asm/uaccess.h>
@@ -154,6 +155,9 @@ static void delayed_put_task_struct(struct rcu_head *rhp)
154{ 155{
155 struct task_struct *tsk = container_of(rhp, struct task_struct, rcu); 156 struct task_struct *tsk = container_of(rhp, struct task_struct, rcu);
156 157
158#ifdef CONFIG_PERF_COUNTERS
159 WARN_ON_ONCE(tsk->perf_counter_ctxp);
160#endif
157 trace_sched_process_free(tsk); 161 trace_sched_process_free(tsk);
158 put_task_struct(tsk); 162 put_task_struct(tsk);
159} 163}
@@ -170,6 +174,7 @@ repeat:
170 atomic_dec(&__task_cred(p)->user->processes); 174 atomic_dec(&__task_cred(p)->user->processes);
171 175
172 proc_flush_task(p); 176 proc_flush_task(p);
177
173 write_lock_irq(&tasklist_lock); 178 write_lock_irq(&tasklist_lock);
174 tracehook_finish_release_task(p); 179 tracehook_finish_release_task(p);
175 __exit_signal(p); 180 __exit_signal(p);
@@ -971,16 +976,19 @@ NORET_TYPE void do_exit(long code)
971 module_put(tsk->binfmt->module); 976 module_put(tsk->binfmt->module);
972 977
973 proc_exit_connector(tsk); 978 proc_exit_connector(tsk);
979
980 /*
981 * Flush inherited counters to the parent - before the parent
982 * gets woken up by child-exit notifications.
983 */
984 perf_counter_exit_task(tsk);
985
974 exit_notify(tsk, group_dead); 986 exit_notify(tsk, group_dead);
975#ifdef CONFIG_NUMA 987#ifdef CONFIG_NUMA
976 mpol_put(tsk->mempolicy); 988 mpol_put(tsk->mempolicy);
977 tsk->mempolicy = NULL; 989 tsk->mempolicy = NULL;
978#endif 990#endif
979#ifdef CONFIG_FUTEX 991#ifdef CONFIG_FUTEX
980 /*
981 * This must happen late, after the PID is not
982 * hashed anymore:
983 */
984 if (unlikely(!list_empty(&tsk->pi_state_list))) 992 if (unlikely(!list_empty(&tsk->pi_state_list)))
985 exit_pi_state_list(tsk); 993 exit_pi_state_list(tsk);
986 if (unlikely(current->pi_state_cache)) 994 if (unlikely(current->pi_state_cache))