summaryrefslogtreecommitdiff
path: root/kernel/events
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2017-09-05 14:44:51 +0300
committerIngo Molnar <mingo@kernel.org>2017-10-27 11:31:58 +0300
commit3c5c8711dcb32115156cc7672fa095afa4339eaa (patch)
tree70fdfef6a45798bf34f646f6130f8dee6fc871f8 /kernel/events
parenta9cd8194e1e6bd09619954721dfaf0f94fe2003e (diff)
downloadlinux-3c5c8711dcb32115156cc7672fa095afa4339eaa.tar.xz
perf/core: Make sure to update ctx time before using it
We should make sure to update ctx time before we use it to update event times. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/events')
-rw-r--r--kernel/events/core.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 0f34f2a47eb6..b249e0f197a7 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -1893,6 +1893,11 @@ __perf_remove_from_context(struct perf_event *event,
{
unsigned long flags = (unsigned long)info;
+ if (ctx->is_active & EVENT_TIME) {
+ update_context_time(ctx);
+ update_cgrp_time_from_cpuctx(cpuctx);
+ }
+
event_sched_out(event, cpuctx, ctx);
if (flags & DETACH_GROUP)
perf_group_detach(event);
@@ -1955,8 +1960,11 @@ static void __perf_event_disable(struct perf_event *event,
if (event->state < PERF_EVENT_STATE_INACTIVE)
return;
- update_context_time(ctx);
- update_cgrp_time_from_event(event);
+ if (ctx->is_active & EVENT_TIME) {
+ update_context_time(ctx);
+ update_cgrp_time_from_event(event);
+ }
+
update_group_times(event);
if (event == event->group_leader)
group_sched_out(event, cpuctx, ctx);