[PATCH] perf,core: do no try to schedule task events if there arenone.

From: Gleb Natapov
Date: Tue Nov 22 2011 - 09:08:33 EST


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.

Signed-off-by: Gleb Natapov <gleb@xxxxxxxxxx>
---

The patch is against tip/perf/urgent since it depends on commit
1d5f003f5a9 there. I've sent updated version of above commit earlier but
unfortunately old version was applied and I do not see amended version
in Peter's queue either. So here is incremental fix.

diff --git a/kernel/events/core.c b/kernel/events/core.c
index b0c1186..920314e 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -2171,11 +2171,11 @@ static void perf_event_context_sched_in(struct perf_event_context *ctx,
*/
cpu_ctx_sched_out(cpuctx, EVENT_FLEXIBLE);

- perf_event_sched_in(cpuctx, ctx, task);
-
if (ctx->nr_events)
cpuctx->task_ctx = ctx;

+ perf_event_sched_in(cpuctx, cpuctx->task_ctx, task);
+
perf_pmu_enable(ctx->pmu);
perf_ctx_unlock(cpuctx, ctx);

--
Gleb.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/