Skip to content

Commit 86b47c2

Browse files
Gleb NatapovIngo Molnar
authored andcommitted
perf: Do no try to schedule task events if there are none
perf_event_sched_in() shouldn't try to schedule task events if there are none otherwise task's ctx->is_active will be set and will not be cleared during sched_out. This will prevent newly added events from being scheduled into the task context. Fixes a boo-boo in commit 1d5f003 ("perf: Do not set task_ctx pointer in cpuctx if there are no events in the context"). Signed-off-by: Gleb Natapov <[email protected]> Signed-off-by: Peter Zijlstra <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent a33caeb commit 86b47c2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kernel/events/core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2174,11 +2174,11 @@ static void perf_event_context_sched_in(struct perf_event_context *ctx,
21742174
*/
21752175
cpu_ctx_sched_out(cpuctx, EVENT_FLEXIBLE);
21762176

2177-
perf_event_sched_in(cpuctx, ctx, task);
2178-
21792177
if (ctx->nr_events)
21802178
cpuctx->task_ctx = ctx;
21812179

2180+
perf_event_sched_in(cpuctx, cpuctx->task_ctx, task);
2181+
21822182
perf_pmu_enable(ctx->pmu);
21832183
perf_ctx_unlock(cpuctx, ctx);
21842184

0 commit comments

Comments
 (0)