Re: [RFC][PATCH 13/19] perf: Per cpu-context rotation timer

From: Peter Zijlstra
Date: Tue Sep 07 2010 - 13:09:08 EST


On Tue, 2010-09-07 at 18:46 +0200, Peter Zijlstra wrote:
> +static enum hrtimer_restart perf_event_context_tick(struct hrtimer
> *timer)
> {
> + enum hrtimer_restart restart = HRTIMER_NORESTART;
> struct perf_cpu_context *cpuctx;
> struct perf_event_context *ctx;
> int rotate = 0;
>
> + cpuctx = container_of(timer, struct perf_cpu_context, timer);
>
> + if (cpuctx->ctx.nr_events) {
> + restart = HRTIMER_RESTART;
> + if (cpuctx->ctx.nr_events != cpuctx->ctx.nr_active)
> + rotate = 1;
> + }
>
> + ctx = current->perf_event_ctxp;
> + if (ctx && ctx->nr_events) {
> + restart = HRTIMER_RESTART;
> + if (ctx->nr_events != ctx->nr_active)
> + rotate = 1;
> + }

Note to self, this is probably racy against pmu_rotate_start().
--
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/