Commit ff1de90d authored by Yury Norov (NVIDIA)'s avatar Yury Norov (NVIDIA) Committed by Peter Zijlstra
Browse files

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: default avatarYury Norov (NVIDIA) <yury.norov@gmail.com>
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: default avatarMadadi Vineeth Reddy <vineethr@linux.ibm.com>
Reviewed-by: default avatarK Prateek Nayak <kprateek.nayak@amd.com>
Reviewed-by: default avatarVincent Guittot <vincent.guittot@linaro.org>
Link: https://patch.msgid.link/20251207040543.407695-1-yury.norov@gmail.com
parent 6ab7973f
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -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 */