summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYury Norov (NVIDIA) <yury.norov@gmail.com>2025-12-07 07:05:42 +0300
committerPeter Zijlstra <peterz@infradead.org>2026-01-08 14:43:56 +0300
commitff1de90dd7a69ef43586683535ad87ab899a1214 (patch)
tree810be0215c7df05a279e3b68ffdb7eb47d09b23f
parent6ab7973f254071faf20fe5fcc502a3fe9ca14a47 (diff)
downloadlinux-ff1de90dd7a69ef43586683535ad87ab899a1214.tar.xz
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) <yury.norov@gmail.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Madadi Vineeth Reddy <vineethr@linux.ibm.com> Reviewed-by: K Prateek Nayak <kprateek.nayak@amd.com> Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org> Link: https://patch.msgid.link/20251207040543.407695-1-yury.norov@gmail.com
-rw-r--r--kernel/sched/fair.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 7377f9117501..64275d75a964 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 */