Re: [PATCH 2/2] sched/fair: Scale wakeup granularity relative to nr_running

From: Peter Zijlstra
Date: Tue Oct 05 2021 - 05:26:25 EST


On Tue, Sep 21, 2021 at 02:32:54PM +0200, Mike Galbraith wrote:
> On Tue, 2021-09-21 at 11:36 +0100, Mel Gorman wrote:

> > FAIR_SLEEPERS primarily affects tasks that just became runnable and the
> > new task is trying to fit in without causing too much disruption based
> > on sysctl_sched_latency.
>
> No, fair sleepers is all about sleeper wakeup preemption, I think
> you're thinking of fork initial placement.

Butting in in the middle of the thread (and I know there's still lots to
read)...

So the FAIR_SLEEPERS thing is about giving tasks that have slept a while
some extra credit to run sooner.

The classical example has always been a task that run 50% combined with
a task that runs 100%, what's fair? a 1:2 or 1:1 ratio? Strict fair
(runnable) scheduling will get you the 1:2, while intuitively having two
tasks with 100% combined CPU utilization 1:1 would be 'fair'.

FAIR_SLEEPERS gets you towards that 1:1, *provided* the period of that
50% is near sched_latency/2.

Another important factor for wakeup preemption has always been desktop
usage; can you still get responsive terminals while building a kernel,
how does firefox scroll during a kernel build etc..

(fwiw, firefox should start scrolling responsively and then bog down if
you keep on scrolling because it becomes a hog and has exhausted the
inital boost)

Also, I think the ChromeOS people have interactivity measures these
days.

All our traditinoal benchmarks miss out here; they're mostly throughput
oriented, and it is really easy to totally wreck interactivity while
getting great througput :/