On Fri, Mar 14, 2025 at 08:21:49AM -1000, Tejun Heo wrote: > Hello, > > On Fri, Mar 14, 2025 at 10:45:35AM +0100, Andrea Righi wrote: > ... > > - if (p->nr_cpus_allowed >= num_possible_cpus()) { > > - if (static_branch_maybe(CONFIG_NUMA, &scx_selcpu_topo_numa)) > > - numa_cpus = numa_span(prev_cpu); > > - > > - if (static_branch_maybe(CONFIG_SCHED_MC, &scx_selcpu_topo_llc)) > > - llc_cpus = llc_span(prev_cpu); > > + if (static_branch_maybe(CONFIG_NUMA, &scx_selcpu_topo_numa)) { > > + struct cpumask *cpus = numa_span(prev_cpu); > > + > > + if (cpus && !cpumask_equal(cpus, p->cpus_ptr)) { > > + if (cpumask_subset(cpus, p->cpus_ptr)) { > > + numa_cpus = cpus; > > + } else { > > + numa_cpus = this_cpu_cpumask_var_ptr(local_numa_idle_cpumask); > > + if (!cpumask_and(numa_cpus, cpus, p->cpus_ptr)) > > + numa_cpus = NULL; > > + } > > + } > > + } > > + if (static_branch_maybe(CONFIG_SCHED_MC, &scx_selcpu_topo_llc)) { > > + struct cpumask *cpus = llc_span(prev_cpu); > > + > > + if (cpus && !cpumask_equal(cpus, p->cpus_ptr)) { > > + if (cpumask_subset(cpus, p->cpus_ptr)) { > > + llc_cpus = cpus; > > + } else { > > + llc_cpus = this_cpu_cpumask_var_ptr(local_llc_idle_cpumask); > > + if (!cpumask_and(llc_cpus, cpus, p->cpus_ptr)) > > + llc_cpus = NULL; > > + } > > + } > > > > Wouldn't it still make sense to special case p->nr_cpus_allowed >= > num_possible_cpus()? That'd be vast majority of cases and we can skip all > the cpumask comparisons for them. Yeah, that's probably a good idea, I'll re-add that in the next version. Thanks, -Andrea