[PATCH v6 07/23] sched/fair: Pull the load on preferred CPU

From: Shrikanth Hegde

Date: Wed Jul 01 2026 - 10:39: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>
---
- Replace active check by preferred instead of adding one.

kernel/sched/fair.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 9b2931b559d6..f2bcf5ff6058 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -14301,6 +14301,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
@@ -14475,9 +14479,10 @@ static int sched_balance_newidle(struct rq *this_rq, struct rq_flags *rf)
this_rq->idle_stamp = rq_clock(this_rq);

/*
- * Do not pull tasks towards !active CPUs...
+ * Do not pull tasks towards !preferred CPUs...
+ * preferred is always a subset of active.
*/
- if (!cpu_active(this_cpu))
+ if (!cpu_preferred(this_cpu))
return 0;

/*
--
2.47.3