All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf: do not set task_ctx pointer in cpuctx if there is no events in the context
@ 2011-10-23 17:10 Gleb Natapov
  2011-11-03  7:41 ` Gleb Natapov
  2011-11-18 23:32 ` [tip:perf/urgent] perf: Do not set task_ctx pointer in cpuctx if there are " tip-bot for Gleb Natapov
  0 siblings, 2 replies; 6+ messages in thread
From: Gleb Natapov @ 2011-10-23 17:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Peter Zijlstra, Paul Mackerras, Ingo Molnar,
	Arnaldo Carvalho de Melo

Do not set task_ctx pointer during sched_in if there is no
events associated with the context.  Otherwise if during task
execution total number of events in the system will become zero
perf_event_context_sched_out() will not be called and cpuctx->task_ctx
will be left with a stale value.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 0f85778..68b13ee 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -2172,7 +2172,8 @@ static void perf_event_context_sched_in(struct perf_event_context *ctx,
 
 	perf_event_sched_in(cpuctx, ctx, task);
 
-	cpuctx->task_ctx = ctx;
+	if (ctx->nr_events)
+		cpuctx->task_ctx = ctx;
 
 	perf_pmu_enable(ctx->pmu);
 	perf_ctx_unlock(cpuctx, ctx);
--
			Gleb.

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-11-18 23:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-23 17:10 [PATCH] perf: do not set task_ctx pointer in cpuctx if there is no events in the context Gleb Natapov
2011-11-03  7:41 ` Gleb Natapov
2011-11-07 13:00   ` Peter Zijlstra
2011-11-13 16:06     ` Gleb Natapov
2011-11-14 10:50       ` Peter Zijlstra
2011-11-18 23:32 ` [tip:perf/urgent] perf: Do not set task_ctx pointer in cpuctx if there are " tip-bot for Gleb Natapov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.