From: Shaohua Li Date: Thu, 5 Feb 2015 23:55:31 +0000 (-0800) Subject: perf: Update shadow timestamp before add event X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=72f669c0086f;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git perf: Update shadow timestamp before add event Update the shadow timestamp before start event, because .add might use the timestamp. Signed-off-by: Shaohua Li Signed-off-by: Peter Zijlstra (Intel) Cc: Andy Lutomirski Cc: Arnaldo Carvalho de Melo Cc: Arnaldo Carvalho de Melo Cc: Frederic Weisbecker Cc: Linus Torvalds Cc: Paul Mackerras Link: http://lkml.kernel.org/r/9cd0276d6a047cb7c2885994f25e3a1f7c8c28af.1423180257.git.shli@fb.com Signed-off-by: Ingo Molnar --- diff --git a/kernel/events/core.c b/kernel/events/core.c index 13209a90b751..e580e0f41ac6 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -1881,6 +1881,10 @@ event_sched_in(struct perf_event *event, perf_pmu_disable(event->pmu); + event->tstamp_running += tstamp - event->tstamp_stopped; + + perf_set_shadow_time(event, ctx, tstamp); + if (event->pmu->add(event, PERF_EF_START)) { event->state = PERF_EVENT_STATE_INACTIVE; event->oncpu = -1; @@ -1888,10 +1892,6 @@ event_sched_in(struct perf_event *event, goto out; } - event->tstamp_running += tstamp - event->tstamp_stopped; - - perf_set_shadow_time(event, ctx, tstamp); - if (!is_software_event(event)) cpuctx->active_oncpu++; if (!ctx->nr_active++)