From: Yury Norov (NVIDIA) Date: Sun, 7 Dec 2025 04:05:42 +0000 (-0500) Subject: sched/fair: Drop useless cpumask_empty() in find_energy_efficient_cpu() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ff1de90dd7a69ef43586683535ad87ab899a1214;p=thirdparty%2Fkernel%2Flinux.git sched/fair: Drop useless cpumask_empty() in find_energy_efficient_cpu() cpumask_empty() call is O(N) and useless because the previous cpumask_and() returns false for empty 'cpus'. Drop it. Signed-off-by: Yury Norov (NVIDIA) Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Madadi Vineeth Reddy Reviewed-by: K Prateek Nayak Reviewed-by: Vincent Guittot Link: https://patch.msgid.link/20251207040543.407695-1-yury.norov@gmail.com --- diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 7377f91175010..64275d75a964d 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -8359,9 +8359,7 @@ static int find_energy_efficient_cpu(struct task_struct *p, int prev_cpu) int max_spare_cap_cpu = -1; int fits, max_fits = -1; - cpumask_and(cpus, perf_domain_span(pd), cpu_online_mask); - - if (cpumask_empty(cpus)) + if (!cpumask_and(cpus, perf_domain_span(pd), cpu_online_mask)) continue; /* Account external pressure for the energy estimation */