[PATCH v5 09/24] sched/fair: Pull the load on preferred CPU

From: Shrikanth Hegde

Date: Thu Jun 25 2026 - 08:48:50 EST


When cpu is marked as non preferred, any load pulled towards it is
pointless since in the next tick task will be pushed out again.

Since load balancing only happens among preferred CPUs, should_we_balance
will bail out. But for NEWIDLE and IDLE balance, this bailout can
happen even earlier.

Signed-off-by: Shrikanth Hegde <sshegde@xxxxxxxxxxxxx>
---
v4->v5:
- new patch

kernel/sched/fair.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 44a0d9736b67..fda8966d9d87 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -14196,6 +14196,10 @@ static void _nohz_idle_balance(struct rq *this_rq, unsigned int flags)
if (!idle_cpu(balance_cpu))
continue;

+ /* There is no point in pulling the load, just to push it out next */
+ if (!cpu_preferred(balance_cpu))
+ continue;
+
/*
* If this CPU gets work to do, stop the load balancing
* work being done for other CPUs. Next load
@@ -14375,6 +14379,10 @@ static int sched_balance_newidle(struct rq *this_rq, struct rq_flags *rf)
if (!cpu_active(this_cpu))
return 0;

+ /* Do not pull to a !preferred CPU just to push it out next */
+ if (!cpu_preferred(this_cpu))
+ return 0;
+
/*
* This is OK, because current is on_cpu, which avoids it being picked
* for load-balance and preemption/IRQs are still disabled avoiding
--
2.47.3