Re: [PATCH v7 2/2] sched/fair: update scale invariance of PELT
From: Peter Zijlstra
Date: Tue Jan 29 2019 - 14:42:27 EST
On Thu, Jan 24, 2019 at 02:04:32PM +0000, Patrick Bellasi wrote:
> > So if I'm not mistaken we then have 3 cases:
> >
> > 1) runnable == util <= capacity
> >
> > no contention, idle
> >
> > 2) runnable == util > capacity
> >
> > no contention, no idle
> >
> > 3) runnable > util
> >
> > contention, no idle
> >
> > For 1) we can use: 'util'
> > For 2) we can use: 'capacity'
> > For 3) we can use: 'util * capacity >> 10'
> >
> > (note that 2 is a special case of 3 when u=1)
> >
> > This should work right?
>
> I think there is a case, similar to 2, in which the new 'util' could
> potentially be used. That's the case for example of a 20% (estimated)
> utilization task running alone on a 15% capacity CPU, for a single
> activation. In that case such a task will complete and be dequeued
> with:
>
> runnable == util > capacity
>
> The problem is that we need to be sure there was not contention... and
> that seems to be difficult to detect.
When there is contention runnable and util should diverge. Given this is
all discrete stuff, there's a few funnies, but who cares about those :-)
> > Now, instead of doing complicated things like that, you instead figure
> > that when there's no idle there's also no dequeue happening and we can
> > simply short-cut by skipping the entire thing, forgetting everything
> > about 2,3.
> >
> > Did I get that right?
>
> More or less... just saying that 1 is the only easy to detect scenario
> in which we are granted the utilization represents an actual bandwidth
> request and thus the only safe values to sample for estimated
> utilization. For the other cases, since anyway:
>
> util_est := max(max(ewma, last_util), util_avg)
>
> util_est will just keep representing a safe and actually measured
> lower-bound for the expected utilization of a task, without
> side-affecting the EWMA which has a "slow" update dynamic.
Right, so maybe we should expound the comment here a bit; but otherwise
I'm inclined to merge that v9 Vincent posted.