Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 147173
b: refs/heads/master
c: eef6cbf
h: refs/heads/master
i:
  147171: 1a055cc
v: v3
  • Loading branch information
Ingo Molnar committed Dec 23, 2008
1 parent 8e37368 commit 14b2bfa
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: aa9c4c0f967fdb482ea95e8473ec3d201e6e0781
refs/heads/master: eef6cbf5844c620d9db9be99e4908cdf92492fb9
9 changes: 9 additions & 0 deletions trunk/include/linux/init_task.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,14 @@ extern struct group_info init_groups;
# define CAP_INIT_BSET CAP_INIT_EFF_SET
#endif

#ifdef CONFIG_PERF_COUNTERS
# define INIT_PERF_COUNTERS(tsk) \
.perf_counter_ctx.counter_list = \
LIST_HEAD_INIT(tsk.perf_counter_ctx.counter_list),
#else
# define INIT_PERF_COUNTERS(tsk)
#endif

/*
* INIT_TASK is used to set up the first task table, touch at
* your own risk!. Base=0, limit=0x1fffff (=2MB)
Expand Down Expand Up @@ -180,6 +188,7 @@ extern struct group_info init_groups;
INIT_IDS \
INIT_TRACE_IRQFLAGS \
INIT_LOCKDEP \
INIT_PERF_COUNTERS(tsk) \
}


Expand Down
21 changes: 9 additions & 12 deletions trunk/kernel/exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ static void delayed_put_task_struct(struct rcu_head *rhp)
{
struct task_struct *tsk = container_of(rhp, struct task_struct, rcu);

#ifdef CONFIG_PERF_COUNTERS
WARN_ON_ONCE(!list_empty(&tsk->perf_counter_ctx.counter_list));
#endif
trace_sched_process_free(tsk);
put_task_struct(tsk);
}
Expand Down Expand Up @@ -922,12 +925,6 @@ static void exit_notify(struct task_struct *tsk, int group_dead)
forget_original_parent(tsk);
exit_task_namespaces(tsk);

/*
* Flush inherited counters to the parent - before the parent
* gets woken up by child-exit notifications.
*/
perf_counter_exit_task(tsk);

write_lock_irq(&tasklist_lock);
if (group_dead)
kill_orphaned_pgrp(tsk->group_leader, NULL);
Expand Down Expand Up @@ -1122,12 +1119,6 @@ NORET_TYPE void do_exit(long code)
if (tsk->splice_pipe)
__free_pipe_info(tsk->splice_pipe);

/*
* These must happen late, after the PID is not
* hashed anymore, but still at a point that may sleep:
*/
perf_counter_exit_task(tsk);

preempt_disable();
/* causes final put_task_struct in finish_task_switch(). */
tsk->state = TASK_DEAD;
Expand Down Expand Up @@ -1371,6 +1362,12 @@ static int wait_task_zombie(struct task_struct *p, int options,
*/
read_unlock(&tasklist_lock);

/*
* Flush inherited counters to the parent - before the parent
* gets woken up by child-exit notifications.
*/
perf_counter_exit_task(p);

retval = ru ? getrusage(p, RUSAGE_BOTH, ru) : 0;
status = (p->signal->flags & SIGNAL_GROUP_EXIT)
? p->signal->group_exit_code : p->exit_code;
Expand Down

0 comments on commit 14b2bfa

Please sign in to comment.