Re: [RESEND RFC PATCH V3] sched: Improve scalability of select_idle_sibling using SMT balance

Peter Zijlstra
2018-02-02T19:59:57Z

On Fri, Feb 02, 2018 at 11:53:40AM -0500, Steven Sistare wrote:
> On 2/1/2018 7:33 AM, Peter Zijlstra wrote:
> > On Mon, Jan 29, 2018 at 03:31:02PM -0800, subhra mazumdar wrote:
> >> + rcu_read_lock();
> >> + sd = rcu_dereference(per_cpu(sd_llc, this_cpu));
> >> + if (util) {
> >> + for_each_lower_domain(sd) {
> >> + if (sd->level == 0)
> >> + break;
> >
> > afaict you really only need this for the core, and here you're assuming
> > everything below the LLC is cores. Would it not be much clearer if you
> > introduce sd_core.
> >
> > As is, for_each_lower_domain includes the starting domain, sd->group
> > then is the first core group for this cpu. But then you continue to the
> > smt domain (on Intel, on other architectures there could be a cluster
> > domain in between) and then you bail using that sd->level == 0 hack
> > because otherwise things would go *bang*.
>
> Hi Peter,
>
> The code here and in smt_balance intentionally visits each level between
> the llc and smt, including core-cluster on architectures that define it.
> smt_balance thus has the chance to randomly pick a better cluster,
> and then within that cluster randomly pick a better core. It makes sense,
> as resources are shared within a cluster, and choosing a less loaded cluster
> should give better performance. As you suggest in a few other places,
> it would be nice to see performance results for this case. We have
> SPARC processors with core clusters.
>

But then you get that atomic crud to contend on the cluster level, which
is even worse than it contending on the core level.