lkml.org 
[lkml]   [2011]   [Oct]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] perf: do not set task_ctx pointer in cpuctx if there is no events in the context
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.

\
 
 \ /
  Last update: 2011-10-23 19:13    [W:0.059 / U:0.220 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site