[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1321267854.1421.4.camel@twins>
Date: Mon, 14 Nov 2011 11:50:54 +0100
From: Peter Zijlstra <a.p.zijlstra@...llo.nl>
To: Gleb Natapov <gleb@...hat.com>
Cc: linux-kernel@...r.kernel.org, Paul Mackerras <paulus@...ba.org>,
Ingo Molnar <mingo@...e.hu>,
Arnaldo Carvalho de Melo <acme@...stprotocols.net>
Subject: Re: [PATCH] perf: do not set task_ctx pointer in cpuctx if there is
no events in the context
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@...hat.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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists