Re: [PATCH 00/15] sched: EEVDF and latency-nice and/or slice-attr

From: Peter Zijlstra
Date: Mon Oct 09 2023 - 10:42:28 EST


On Sun, Oct 08, 2023 at 12:04:00AM +0200, Peter Zijlstra wrote:
> On Thu, Oct 05, 2023 at 02:05:57PM +0200, Peter Zijlstra wrote:
>
> > t=10 V=4 t=10 V=4
> > A |----< A |----<
> > B |< >B |<
> > >C |----------------< C |----------------<
> > |---*-----|---------|---------|---------|---- |---*-----|---------|---------|---------|----
> >
>
> >
> > t=52 V=18 t=36 V=13
> > A |----< A |----<
> > >B |< B |<
> > C |----------------< >C |----------------<
> > |---------|-------*-|---------|---------|---- |---------|--*------|---------|---------|----
> >
>
> >
> > BAaaBCccccccccBBBAaaBBBAaaBB BBAaaBBBAaaBBBAaaBCccccccccB
> >
> >
> >
> > As I wrote before; EVDF has worse lag bounds, but this is not
> > insurmountable. The biggest problem that I can see is that of wakeup
> > preemption. Currently we allow to preempt when 'current' has reached V
> > (RUN_TO_PARITY in pick_eevdf()).
> >
> > With these rules, when EEVDF schedules C (our large slice task) at t=10
> > above, it is only a little behind C and can be reaily preempted after
> > about 2 time units.
> >
> > However, EVDF will delay scheduling C until much later, see how A and B
> > walk far ahead of V until t=36. Only when will we pick C. But this means
> > that we're firmly stuck with C for at least 11 time units. A newly
> > placed task will be around V and will have no chance to preempt.
>
> Playing around with it a little:
>
> EEVDF EVDF
>
> slice 30000000 slice 30000000
> # Min Latencies: 00014 # Min Latencies: 00048
> # Avg Latencies: 00692 # Avg Latencies: 188239
> # Max Latencies: 94633 # Max Latencies: 961241
>
> slice 3000000 slice 3000000
> # Min Latencies: 00054 # Min Latencies: 00055
> # Avg Latencies: 00522 # Avg Latencies: 00673
> # Max Latencies: 41475 # Max Latencies: 13297
>
> slice 300000 slice 300000
> # Min Latencies: 00018 # Min Latencies: 00024
> # Avg Latencies: 00344 # Avg Latencies: 00056
> # Max Latencies: 20061 # Max Latencies: 00860
>
>
> So while it improves the short slices, it completely blows up the large
> slices -- utterly slaughters the large slices in fact.
>
> And all the many variants of BIAS_ELIGIBLE that I've tried so far only
> manage to murder the high end while simultaneously not actually helping
> the low end -- so that's a complete write off.
>
>
> By far the sanest option so far is PLACE_SLEEPER -- and that is very
> much not a nice option either :-(

And this can be easily explained by the fact that we insert tasks around
0-lag, so if we delay execution past this point we create an effective
DoS window.