Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

sched/fair: Use cpumask_weight_and() in sched_balance_find_dst_group()

In the group_has_spare case, the function creates a temporary cpumask
to just calculate weight of (p->cpus_ptr & sched_group_span(local)).

We've got a dedicated helper for it.

Signed-off-by: Yury Norov (NVIDIA) <yury.norov@gmail.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Reviewed-by: K Prateek Nayak <kprateek.nayak@amd.com>
Reviewed-by: Fernand Sieber <sieberf@amazon.com>
Link: https://patch.msgid.link/20251207034247.402926-1-yury.norov@gmail.com

authored by

Yury Norov (NVIDIA) and committed by
Peter Zijlstra
55b39b0c 0ab25ea2

+3 -4
+3 -4
kernel/sched/fair.c
··· 10974 10974 * take care of it. 10975 10975 */ 10976 10976 if (p->nr_cpus_allowed != NR_CPUS) { 10977 - struct cpumask *cpus = this_cpu_cpumask_var_ptr(select_rq_mask); 10978 - 10979 - cpumask_and(cpus, sched_group_span(local), p->cpus_ptr); 10980 - imb_numa_nr = min(cpumask_weight(cpus), sd->imb_numa_nr); 10977 + unsigned int w = cpumask_weight_and(p->cpus_ptr, 10978 + sched_group_span(local)); 10979 + imb_numa_nr = min(w, sd->imb_numa_nr); 10981 10980 } 10982 10981 10983 10982 imbalance = abs(local_sgs.idle_cpus - idlest_sgs.idle_cpus);