Re: [PATCH v2 1/2] perf/core: add perf_ctx_resched() as global function

From: Peter Zijlstra
Date: Mon Apr 15 2019 - 11:53:55 EST


On Mon, Apr 15, 2019 at 05:45:37PM +0200, Peter Zijlstra wrote:
> On Mon, Apr 08, 2019 at 10:32:51AM -0700, Stephane Eranian wrote:
> > This patch add perf_ctx_resched() a global function that can be called
> > to force rescheduling of events based on event types. The function locks
> > both cpuctx and task_ctx internally. This will be used by a subsequent patch.
>
> I took out the task_ctx and event_type arguments.

> +void perf_ctx_resched(struct perf_cpu_context *cpuctx)
> +{
> + struct perf_event_context *task_ctx = cpuctx->task_ctx;
> +
> + perf_ctx_lock(cpuctx, task_ctx);
> + ctx_resched(cpuctx, task_ctx, EVENT_ALL|EVENT_CPU);
> + perf_ctx_unlock(cpuctx, task_ctx);
> +}

Hmm... I might just rework the thing to:

perf_pmu_resched(struct pmu *pmu);

As that is what we want; esp. in the light of that whole core context
rewrite that i'm still sitting on :/