Re: EEVDF and NUMA balancing

From: Ingo Molnar
Date: Wed Oct 04 2023 - 14:15:21 EST



* Julia Lawall <julia.lawall@xxxxxxxx> wrote:

>
>
> On Wed, 4 Oct 2023, Peter Zijlstra wrote:
>
> > On Wed, Oct 04, 2023 at 02:01:26PM +0200, Julia Lawall wrote:
> > >
> > >
> > > On Tue, 3 Oct 2023, Peter Zijlstra wrote:
> > >
> > > > On Tue, Oct 03, 2023 at 10:25:08PM +0200, Julia Lawall wrote:
> > > > > Is it expected that the commit e8f331bcc270 should have an impact on the
> > > > > frequency of NUMA balancing?
> > > >
> > > > Definitely not expected. The only effect of that commit was supposed to
> > > > be the runqueue order of tasks. I'll go stare at it in the morning --
> > > > definitely too late for critical thinking atm.
> > >
> > > Maybe it's just randomly making a bad situation worse rather than directly
> > > introduing a problem. There is a high standard deviatind in the
> > > performance. Here are some results with hyperfine. The general trends
> > > are reproducible.
> >
> > OK,. I'm still busy trying to bring a 4 socket machine up-to-date...
> > gawd I hate the boot times on those machines :/
> >
> > But yeah, I was thinking similar things, I really can't spot an obvious
> > fail in that commit.
> >
> > I'll go have a poke once the darn machine is willing to submit :-)
>
> I tried a two-socket machine, but in 50 runs the problem doesn't show up.
>
> The commit e8f331bcc270 starts with
>
> - if (sched_feat(PLACE_LAG) && cfs_rq->nr_running > 1) {
> + if (sched_feat(PLACE_LAG) && cfs_rq->nr_running) {
>
> This seemed like a big change - cfs_rq->nr_running > 1 should be rarely
> true in ua, while cfs_rq->nr_running should always be true. Adding back
> the > 1 and simply replacing the test by 0 both had no effect, though.

BTW., in terms of statistical reliability, one of the biggest ...
stochastic elements of scheduler balancing is wakeup-preemption - which
you can turn off via:

echo NO_WAKEUP_PREEMPTION > /debug/sched/features

or:

echo NO_WAKEUP_PREEMPTION > /sys/kernel/debug/sched/features

If you can measure a performance regression with WAKEUP_PREEMPTION turned
off in *both* kernels, there's likely a material change (regression) in the
quality of NUMA load-balancing.

If it goes away or changes dramatically with WAKEUP_PREEMPTION off, then
I'd pin this effect to EEVDF causing timing changes that are subtly
shifting NUMA & SMP balancing decisions past some critical threshold that
is detrimental to this particular workload.

( Obviously both are regressions we care about - but doing this test would
help categorize the nature of the regression. )

Thanks,

Ingo