mirror of
https://github.com/torvalds/linux.git
synced 2026-10-07 05:31:08 -04:00
perf: Fix scaling vs. perf_event_enable_on_exec()
The recent commit3e349507d1("perf: Fix perf_enable_on_exec() event scheduling") caused this by moving task_ctx_sched_out() from before __perf_event_mask_enable() to after it. The overlooked consequence of that change is that task_ctx_sched_out() would update the ctx time fields, and now __perf_event_mask_enable() uses stale time. In order to fix this, explicitly stop our context's time before enabling the event(s). Reported-by: Oleg Nesterov <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Arnaldo Carvalho de Melo <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Fixes:3e349507d1("perf: Fix perf_enable_on_exec() event scheduling") Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
This commit is contained in:
1 parent
3cbaa59069
commit
7fce250915
1 file changed
+1
@@ -3143,6 +3143,7 @@ static void perf_event_enable_on_exec(int ctxn)
|
||||
|
||||
cpuctx = __get_cpu_context(ctx);
|
||||
perf_ctx_lock(cpuctx, ctx);
|
||||
ctx_sched_out(ctx, cpuctx, EVENT_TIME);
|
||||
list_for_each_entry(event, &ctx->event_list, event_entry)
|
||||
enabled |= event_enable_on_exec(event, ctx);
|
||||
|
||||
|
||||
Reference in new issue
Block a user