[PATCH v3 08/20] sched/fair: load balance only among preferred CPUs
From: Shrikanth Hegde
Date: Thu May 14 2026 - 11:29:32 EST
Consider only preferred CPUs for load balance.
With this, load balance will end up choosing a preferred CPUs for pull.
This makes it not fight against the push task mechanism which happens
at tick. Also, this stops active balance to happen on non-preferred CPU
pulling the load.
This means there is no load balancing if the task is pinned only to
non-preferred CPUs. They will continue to run where they were previously
running before the CPUs was marked as non-preferred.
Signed-off-by: Shrikanth Hegde <sshegde@xxxxxxxxxxxxx>
---
kernel/sched/fair.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index a704285ac55a..0a851d4b0d7e 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -12087,6 +12087,9 @@ static int sched_balance_rq(int this_cpu, struct rq *this_rq,
cpumask_and(cpus, sched_domain_span(sd), cpu_active_mask);
+ /* Spread load among preferred CPUs */
+ cpumask_and(cpus, cpus, cpu_preferred_mask);
+
schedstat_inc(sd->lb_count[idle]);
redo:
--
2.47.3