Re: [PATCH] sched/fair: properly serialize the cfs_rq h_load calculation
From: Peter Zijlstra
Date: Mon Nov 25 2024 - 05:01:21 EST
On Fri, Nov 22, 2024 at 06:33:31PM +0100, Daniel Vacek wrote:
> On Fri, Nov 22, 2024 at 4:42 PM Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
> >
> > On Fri, Nov 22, 2024 at 04:28:55PM +0100, Daniel Vacek wrote:
> > > Make sure the given cfs_rq's h_load is always correctly updated. This
> > > prevents a race between more CPUs eventually updating the same hierarchy
> > > of h_load_next return pointers.
> >
> > Is there an actual problem observed?
>
> Well, that depends. Do we care about correct (exact) load calculation
> every time?
The whole load balancer is full of races. And typically it all more or
less works out.
I mean, the worst case is typically a spurious migration, which will get
'fixed' up the next round.
Only if behaviour gets to be really bad/stupid do we tend to try and fix
this.
Now your patch didn't look awful :-), but it would make a stronger case
if you'd done it because you observed it doing stupid and it now no
longer does stupid and your workload improves.