On Wed, Apr 07, 2021 at 10:41:06AM +0100, Mel Gorman wrote: > > --- a/kernel/sched/fair.c > > +++ b/kernel/sched/fair.c > > @@ -6112,6 +6112,27 @@ static int select_idle_core(struct task_ > > return -1; > > } > > > > +/* > > + * Scan the local SMT mask for idle CPUs. > > + */ > > +static int select_idle_smt(struct task_struct *p, struct sched_domain *sd, > > int target) > > +{ > > + int cpu; > > + > > + if (!static_branch_likely(&sched_smt_present)) > > + return -1; > > + > > + for_each_cpu(cpu, cpu_smt_mask(target)) { > > + if (!cpumask_test_cpu(cpu, p->cpus_ptr) || > > + !cpumask_test_cpu(cpu, sched_domain_span(sd))) > > + continue; > > While I know that !cpumask_test_cpu(cpu, sched_domain_span(sd)) was > done previously, I found it hard to believe that the test matters. If > target/prev share a the LLC domain, why would the SMT siblings *not* > share a LLC?
I think the reason for it is that a cpuset might have split the siblings apart and disabled load-balancing across them or something. Then the affinity mask can still cross the partition, but we shouldn't ever move into it through balancing.