Re: [PATCH] sched/fair: Prefer idle CPU to cache affinity

From: Srikar Dronamraju
Date: Mon Mar 01 2021 - 15:54:34 EST


* Peter Zijlstra <peterz@xxxxxxxxxxxxx> [2021-03-01 16:40:33]:

> On Fri, Feb 26, 2021 at 10:10:29PM +0530, Srikar Dronamraju wrote:
> > +static int prefer_idler_llc(int this_cpu, int prev_cpu, int sync)
> > +{
> > + struct sched_domain_shared *tsds, *psds;
> > + int pnr_busy, pllc_size, tnr_busy, tllc_size, diff;
> > +
> > + tsds = rcu_dereference(per_cpu(sd_llc_shared, this_cpu));
> > + tnr_busy = atomic_read(&tsds->nr_busy_cpus);
> > + tllc_size = per_cpu(sd_llc_size, this_cpu);
> > +
> > + psds = rcu_dereference(per_cpu(sd_llc_shared, prev_cpu));
> > + pnr_busy = atomic_read(&psds->nr_busy_cpus);
> > + pllc_size = per_cpu(sd_llc_size, prev_cpu);
> > +
>
> nr_busy_cpus is NO_HZ_COMMON So this code that consumes it should be
> too.

Thanks Peter, will take care of this along with other changes including
calling within rcu_read_lock and checking for tsds and psds after
rcu_dereference.

--
Thanks and Regards
Srikar Dronamraju