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

From: Peter Zijlstra
Date: Mon Mar 01 2021 - 16:35:08 EST


On Mon, Mar 01, 2021 at 10:36:01PM +0530, Srikar Dronamraju wrote:
> * Peter Zijlstra <peterz@xxxxxxxxxxxxx> [2021-03-01 16:44:42]:
>
> > On Sat, Feb 27, 2021 at 02:56:07PM -0500, Rik van Riel wrote:
> > > On Fri, 2021-02-26 at 22:10 +0530, Srikar Dronamraju wrote:
> >
> > > > + if (sched_feat(WA_WAKER) && tnr_busy < tllc_size)
> > > > + return this_cpu;
> > >
> > > I wonder if we need to use a slightly lower threshold on
> > > very large LLCs, both to account for the fact that the
> > > select_idle_cpu code may not find the single idle CPU
> > > among a dozen busy ones, or because on a system with
> > > hyperthreading we may often be better off picking another
> > > LLC for HT contention issues?
> > >
> > > Maybe we could use "tnr_busy * 4 <
> > > tllc_size * 3" or
> > > something like that?
> >
> > How about:
> >
> > tnr_busy < tllc_size / topology_max_smt_threads()
> >
> > ?
>
> Isn't topology_max_smt_threads only for x86 as of today?
> Or Am I missing out?

Oh, could be, I didn't grep :/ We could have core code keep track of the
smt count I suppose.