Re: [PATCH 00/15] sched: EEVDF and latency-nice and/or slice-attr
From: Youssef Esmat
Date: Mon Oct 09 2023 - 20:51:21 EST
On Sat, Oct 7, 2023 at 5:04 PM Peter Zijlstra <peterz@xxxxxxxxxxxxx> 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
>
Thanks for sharing. Which workload was used to generate these numbers?
I think looking at the sched latency numbers alone does not show the
complete picture. I ran the same input latency test again and tried to
capture some of these numbers for the chrome processes.
EEVDF 1.5ms slice:
Input latency test result: 226ms
perf sched latency:
switches: 1,084,694
avg: 1.139 ms
max: 408.397 ms
EEVDF 6.0ms slice:
Input latency test result: 178ms
perf sched latency:
switches: 892,306
avg: 1.145 ms
max: 354.344 ms
EVDF 6.0ms slice:
Input latency test result: 112ms
perf sched latency:
switches: 134,200
avg: 2.610 ms
max: 374.888 ms
EVDF 6.0ms slice
(no run_to_parity, no place_lag, no place_deadline_initial):
Input latency test result: 110ms
perf sched latency:
switches: 531,656
avg: 0.830 ms
max: 520.463 ms
For our scenario, it is very expensive to interrupt UI threads. It
will increase the input latency significantly. Lowering the scheduling
latency at the cost of switching out important threads can be very
detrimental in this workload. UI and input threads run with a nice
value of -8.
This also seems to match Daniel's message earlier in this thread where
using 12ms base slice improved their benchmarks.
That said, this might not be beneficial for all workloads, and we are
still trying our other workloads out.
>
> 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 :-(