2013-07-23 08:13:37

by Stephane Eranian

[permalink] [raw]
Subject: perf: question about event scheduler

Hi,

I am looking at ctx_pinned_sched_in() and
ctx_flexible_sched_in() and I am trying to
understand the difference of treatment in
case of errors for the two classes of events
(pinned vs. flexible).

For pinned events, when a group fails to
schedule in, the code goes on to the next
group and therefore walks the entire list
for each scheduler invocation.

For flexible events, when a group fails,
the loop aborts and no subsequent group
is tried.

I am trying to understand the motivation for
this difference here.

If I recall, the abort is here to limit malicious
DoS where a malicious user would provide
an arbitrary long list of events, hogging the kernel.
But in the case of pinned events, this is ignored
because to create such events one needs to be
root in the first place.

Am I getting this right?


2013-07-23 09:48:47

by Peter Zijlstra

[permalink] [raw]
Subject: Re: perf: question about event scheduler

On Tue, Jul 23, 2013 at 10:13:33AM +0200, Stephane Eranian wrote:
> Hi,
>
> I am looking at ctx_pinned_sched_in() and
> ctx_flexible_sched_in() and I am trying to
> understand the difference of treatment in
> case of errors for the two classes of events
> (pinned vs. flexible).
>
> For pinned events, when a group fails to
> schedule in, the code goes on to the next
> group and therefore walks the entire list
> for each scheduler invocation.
>
> For flexible events, when a group fails,
> the loop aborts and no subsequent group
> is tried.
>
> I am trying to understand the motivation for
> this difference here.
>
> If I recall, the abort is here to limit malicious
> DoS where a malicious user would provide
> an arbitrary long list of events, hogging the kernel.
> But in the case of pinned events, this is ignored
> because to create such events one needs to be
> root in the first place.
>
> Am I getting this right?

Whee, long time ago. I think the biggest reason is that pinned events
should always be scheduled. Not being able to schedule a pinned event is
an error. But yes, that and the fact that they're root only.

2013-07-29 09:23:50

by Stephane Eranian

[permalink] [raw]
Subject: Re: perf: question about event scheduler

On Tue, Jul 23, 2013 at 11:48 AM, Peter Zijlstra <[email protected]> wrote:
>
> On Tue, Jul 23, 2013 at 10:13:33AM +0200, Stephane Eranian wrote:
> > Hi,
> >
> > I am looking at ctx_pinned_sched_in() and
> > ctx_flexible_sched_in() and I am trying to
> > understand the difference of treatment in
> > case of errors for the two classes of events
> > (pinned vs. flexible).
> >
> > For pinned events, when a group fails to
> > schedule in, the code goes on to the next
> > group and therefore walks the entire list
> > for each scheduler invocation.
> >
> > For flexible events, when a group fails,
> > the loop aborts and no subsequent group
> > is tried.
> >
> > I am trying to understand the motivation for
> > this difference here.
> >
> > If I recall, the abort is here to limit malicious
> > DoS where a malicious user would provide
> > an arbitrary long list of events, hogging the kernel.
> > But in the case of pinned events, this is ignored
> > because to create such events one needs to be
> > root in the first place.
> >
> > Am I getting this right?
>
> Whee, long time ago. I think the biggest reason is that pinned events
> should always be scheduled. Not being able to schedule a pinned event is
> an error. But yes, that and the fact that they're root only.
>
>
Ok, that's what I thought then.
Thanks,