Messages in this thread Patch in this message | | | Subject | Re: [PATCH] perf: do not set task_ctx pointer in cpuctx if there is no events in the context | From | Peter Zijlstra <> | Date | Mon, 14 Nov 2011 11:50:54 +0100 |
| |
On Sun, 2011-11-13 at 18:06 +0200, Gleb Natapov wrote: > On Mon, Nov 07, 2011 at 02:00:11PM +0100, Peter Zijlstra wrote: > > On Thu, 2011-11-03 at 09:41 +0200, Gleb Natapov wrote: > > > Ingo, Peter can you look into this please. > > > > queued it and the jump_label thing. > I see jump_label thing in tip/perf/core but not this one yet. This is > good because this one needs amendment :) See below.
Weird ass stuff, because my copy still applies to tip/master. Ingo, wtf is up?
> --- > > 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. Also perf_event_sched_in() shouldn't try > to schedule task events in this case otherwise cpuctx->task_ctx->is_active > will not be cleared during sched_out and will become incorrect. > > Signed-off-by: Gleb Natapov <gleb@redhat.com>
--- missing right there
> diff --git a/kernel/events/core.c b/kernel/events/core.c > index d1a1bee..7210657 100644 > --- a/kernel/events/core.c > +++ b/kernel/events/core.c > @@ -2171,9 +2171,10 @@ 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; > > - cpuctx->task_ctx = ctx; > + perf_event_sched_in(cpuctx, cpuctx->task_ctx, task); > > perf_pmu_enable(ctx->pmu); > perf_ctx_unlock(cpuctx, ctx); > -- > Gleb.
| |