aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/exit.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/exit.c')
-rw-r--r--kernel/exit.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/kernel/exit.c b/kernel/exit.c
index f80dec3f1875..a1b18c03b4c0 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -159,6 +159,9 @@ static void delayed_put_task_struct(struct rcu_head *rhp)
159{ 159{
160 struct task_struct *tsk = container_of(rhp, struct task_struct, rcu); 160 struct task_struct *tsk = container_of(rhp, struct task_struct, rcu);
161 161
162#ifdef CONFIG_PERF_COUNTERS
163 WARN_ON_ONCE(!list_empty(&tsk->perf_counter_ctx.counter_list));
164#endif
162 trace_sched_process_free(tsk); 165 trace_sched_process_free(tsk);
163 put_task_struct(tsk); 166 put_task_struct(tsk);
164} 167}
@@ -977,12 +980,9 @@ static void check_stack_usage(void)
977{ 980{
978 static DEFINE_SPINLOCK(low_water_lock); 981 static DEFINE_SPINLOCK(low_water_lock);
979 static int lowest_to_date = THREAD_SIZE; 982 static int lowest_to_date = THREAD_SIZE;
980 unsigned long *n = end_of_stack(current);
981 unsigned long free; 983 unsigned long free;
982 984
983 while (*n == 0) 985 free = stack_not_used(current);
984 n++;
985 free = (unsigned long)n - (unsigned long)end_of_stack(current);
986 986
987 if (free >= lowest_to_date) 987 if (free >= lowest_to_date)
988 return; 988 return;
@@ -1093,10 +1093,6 @@ NORET_TYPE void do_exit(long code)
1093 tsk->mempolicy = NULL; 1093 tsk->mempolicy = NULL;
1094#endif 1094#endif
1095#ifdef CONFIG_FUTEX 1095#ifdef CONFIG_FUTEX
1096 /*
1097 * This must happen late, after the PID is not
1098 * hashed anymore:
1099 */
1100 if (unlikely(!list_empty(&tsk->pi_state_list))) 1096 if (unlikely(!list_empty(&tsk->pi_state_list)))
1101 exit_pi_state_list(tsk); 1097 exit_pi_state_list(tsk);
1102 if (unlikely(current->pi_state_cache)) 1098 if (unlikely(current->pi_state_cache))
@@ -1363,6 +1359,12 @@ static int wait_task_zombie(struct task_struct *p, int options,
1363 */ 1359 */
1364 read_unlock(&tasklist_lock); 1360 read_unlock(&tasklist_lock);
1365 1361
1362 /*
1363 * Flush inherited counters to the parent - before the parent
1364 * gets woken up by child-exit notifications.
1365 */
1366 perf_counter_exit_task(p);
1367
1366 retval = ru ? getrusage(p, RUSAGE_BOTH, ru) : 0; 1368 retval = ru ? getrusage(p, RUSAGE_BOTH, ru) : 0;
1367 status = (p->signal->flags & SIGNAL_GROUP_EXIT) 1369 status = (p->signal->flags & SIGNAL_GROUP_EXIT)
1368 ? p->signal->group_exit_code : p->exit_code; 1370 ? p->signal->group_exit_code : p->exit_code;