Commit 96c21a46 authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Ingo Molnar

perf: Fix exit() vs event-groups

Corey reported that the value scale times of group siblings are not
updated when the monitored task dies.

The problem appears to be that we only update the group leader's
time values, fix it by updating the whole group.
Reported-by: default avatarCorey Ashford <cjashfor@linux.vnet.ibm.com>
Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: <stable@kernel.org> # .34.x
LKML-Reference: <1273588935.1810.6.camel@laptop>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 050735b0
...@@ -255,6 +255,18 @@ static void update_event_times(struct perf_event *event) ...@@ -255,6 +255,18 @@ static void update_event_times(struct perf_event *event)
event->total_time_running = run_end - event->tstamp_running; event->total_time_running = run_end - event->tstamp_running;
} }
/*
* Update total_time_enabled and total_time_running for all events in a group.
*/
static void update_group_times(struct perf_event *leader)
{
struct perf_event *event;
update_event_times(leader);
list_for_each_entry(event, &leader->sibling_list, group_entry)
update_event_times(event);
}
static struct list_head * static struct list_head *
ctx_group_list(struct perf_event *event, struct perf_event_context *ctx) ctx_group_list(struct perf_event *event, struct perf_event_context *ctx)
{ {
...@@ -320,7 +332,7 @@ list_del_event(struct perf_event *event, struct perf_event_context *ctx) ...@@ -320,7 +332,7 @@ list_del_event(struct perf_event *event, struct perf_event_context *ctx)
if (event->group_leader != event) if (event->group_leader != event)
event->group_leader->nr_siblings--; event->group_leader->nr_siblings--;
update_event_times(event); update_group_times(event);
/* /*
* If event was in error state, then keep it * If event was in error state, then keep it
...@@ -501,18 +513,6 @@ static void perf_event_remove_from_context(struct perf_event *event) ...@@ -501,18 +513,6 @@ static void perf_event_remove_from_context(struct perf_event *event)
raw_spin_unlock_irq(&ctx->lock); raw_spin_unlock_irq(&ctx->lock);
} }
/*
* Update total_time_enabled and total_time_running for all events in a group.
*/
static void update_group_times(struct perf_event *leader)
{
struct perf_event *event;
update_event_times(leader);
list_for_each_entry(event, &leader->sibling_list, group_entry)
update_event_times(event);
}
/* /*
* Cross CPU call to disable a performance event * Cross CPU call to disable a performance event
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment