Re: [RFC][PATCH] perf: Rewrite core context handling

From: Peter Zijlstra
Date: Wed Oct 17 2018 - 14:33:28 EST


On Wed, Oct 17, 2018 at 07:19:55PM +0200, Peter Zijlstra wrote:
> On Wed, Oct 17, 2018 at 04:43:27PM +0000, Song Liu wrote:
>
> > > That makes task and cpu contexts wildly different, which will complicate
> > > matters I feel.
> > >
> >
> > I think we only need different logic when adding events to the task/cpu
> > contexts. The ctx_sched_in() and ctx_sched_out() will need some extra
> > logic to filter out events that are not being scheduled (don't schedule
> > events on PMU-a when rotating PMU-b). This logic will be the same for
> > task and cpu context. The difference is, the CPU context will not have
> > such events, because we never added such event to CPU context.
> >
> > Does this make sense? I could try draft a RFC to see how difficult it is.
>
> I'm not sure it saves much, if we have multiple per-cpu contexts we get
> to re-introduce the active_ctx_list and loose the simplification for the
> online status.
>
> Plus that fundamental assymetry -- which would bother my OCD forever
> more :-)

Worse, the whole syscall that installs the events will come apart. The
locking for the two cases is different :/