[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aS8MWtq0T0HaRm_9@gmail.com>
Date: Tue, 2 Dec 2025 16:57:14 +0100
From: Ingo Molnar <mingo@...nel.org>
To: Peter Zijlstra <peterz@...radead.org>
Cc: linux-kernel@...r.kernel.org, Juri Lelli <juri.lelli@...hat.com>,
Dietmar Eggemann <dietmar.eggemann@....com>,
Valentin Schneider <vschneid@...hat.com>,
Vincent Guittot <vincent.guittot@...aro.org>,
Shrikanth Hegde <sshegde@...ux.ibm.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Mel Gorman <mgorman@...e.de>, Steven Rostedt <rostedt@...dmis.org>,
Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH 5/6] sched/fair: Rename cfs_rq::avg_load to
cfs_rq::sum_weight
* Peter Zijlstra <peterz@...radead.org> wrote:
> On Mon, Dec 01, 2025 at 07:46:46AM +0100, Ingo Molnar wrote:
> > The ::avg_load field is a long-standing misnomer: it says it's an
> > 'average load', but in reality it's the momentary sum of the load
> > of all currently runnable tasks. We'd have to also perform a
> > division by nr_running (or use time-decay) to arrive at any sort
> > of average value.
> >
> > This is clear from comments about the math of fair scheduling:
> >
> > * \Sum w_i := cfs_rq->avg_load
> >
> > The sum of all weights is ... the sum of all weights, not
> > the average of all weights.
> >
> > To make it doubly confusing, there's also an ::avg_load
> > in the load-balancing struct sg_lb_stats, which *is* a
> > true average.
> >
> > The second part of the field's name is a minor misnomer
> > as well: it says 'load', and it is indeed a load_weight
> > structure as it shares code with the load-balancer - but
> > it's only in an SMP load-balancing context where
> > load = weight, in the fair scheduling context the primary
> > purpose is the weighting of different nice levels.
> >
> > So rename the field to ::sum_weight instead, which makes
> > the terminology of the EEVDF math match up with our
> > implementation of it:
> >
> > * \Sum w_i := cfs_rq->sum_weight
> >
> > Signed-off-by: Ingo Molnar <mingo@...nel.org>
>
> Bah, this is going to be a pain rebasing for me, but yes, these
> variables are poorly named. 'sum_weight' is a better name.
Fair enough, and to make this easier for you I've
rebased your worst affected tree (queue.git:sched/flat)
on top of the mingo/tip:WIP.sched/core-for-v6.20 tree,
which includes these renames (with all your feedback
addressed AFAICT), see:
git://git.kernel.org/pub/scm/linux/kernel/git/mingo/tip.git WIP.sched/flat
... and it builds and boots. :-)
Thanks,
Ingo
Powered by blists - more mailing lists