Re: [RFC][PATCH 02/12] perf: Fix cgroup event scheduling
From: Peter Zijlstra
Date: Mon Jan 11 2016 - 17:03:24 EST
On Mon, Jan 11, 2016 at 11:43:40AM -0800, Stephane Eranian wrote:
> Peter,
>
> On Mon, Jan 11, 2016 at 8:25 AM, Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
> > There appears to be a problemin __perf_event_task_sched_in() wrt
> > cgroup event scheduling.
> >
> > The normal event scheduling order is:
> >
> > CPU pinned
> > Task pinned
> > CPU flexible
> > Task flexible
> >
> > And since perf_cgroup_sched*() only schedules the cpu context, we must
> > call this _before_ adding the task events.
> >
> I understand this but I am trying to understand why cgroup system-wide event
> would be treated differently from regular system-wide events w.r.t. task events
> here.
This patch is about making cgroup events behave similarly to regular
system-wide events.
> If I do a cgroup flexible and a task pinned, what happens?
Look at perf_event_context_sched_in(), it will first remove the
cpu-flexible and then install everything:
cpu-pinned (skipped, because that would still be present)
task-pinned (new)
cpu-flexible (re-issue, possibly truncated due to the new pinned events)
task-flexible (new)