Re: [PATCH 7/7] sched/fair: Rename weighted_cpuload() to cpu_load()
From: Peter Zijlstra
Date: Mon May 27 2019 - 15:16:50 EST
On Mon, May 27, 2019 at 12:24:07PM -0400, Rik van Riel wrote:
> On Mon, 2019-05-27 at 07:21 +0100, Dietmar Eggemann wrote:
> > This is done to align the per cpu (i.e. per rq) load with the util
> > counterpart (cpu_util(int cpu)). The term 'weighted' is not needed
> > since there is no 'unweighted' load to distinguish it from.
>
> I can see why you want to make cpu_util() and cpu_load()
> have the same parameter, but ...
>
> > @@ -7931,7 +7928,7 @@ static inline void update_sg_lb_stats(struct
> > lb_env *env,
> > if ((env->flags & LBF_NOHZ_STATS) &&
> > update_nohz_stats(rq, false))
> > env->flags |= LBF_NOHZ_AGAIN;
> >
> > - sgs->group_load += weighted_cpuload(rq);
> > + sgs->group_load += cpu_load(i);
> > sgs->group_util += cpu_util(i);
> > sgs->sum_nr_running += rq->cfs.h_nr_running;
>
> ... now we end up dereferencing cpu_rq(cpu) 3 times.
>
> I guess per-cpu variables are so cheap that we should
> never notice, but I thought I'd ask anyway while looking
> over these patches :)
I was going to say CSE should fix that, but then I noticed per_cpu
contains that hideous RELOC_HIDE() thing and I figure that might
confuse GCC enough to break that :/