[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260102124744.360872-2-sshegde@linux.ibm.com>
Date: Fri, 2 Jan 2026 18:17:42 +0530
From: Shrikanth Hegde <sshegde@...ux.ibm.com>
To: mingo@...nel.org, peterz@...radead.org, vincent.guittot@...aro.org
Cc: sshegde@...ux.ibm.com, linux-kernel@...r.kernel.org,
kprateek.nayak@....com, juri.lelli@...hat.com, vschneid@...hat.com,
tglx@...utronix.de, dietmar.eggemann@....com, anna-maria@...utronix.de,
frederic@...nel.org, wangyang.guo@...el.com
Subject: [PATCH v2 1/3] sched/fair: Move checking for nohz cpus after time check
Idle load balancer is kicked off only after time check. So move
the atomic read after the time check to avoid the overhead.
If there are no nohz CPUs and next_blocked has passed, then there
will be one additional stats based load balancing which would set the
has_blocked_load to 0. It shouldn't make a difference.
Signed-off-by: Shrikanth Hegde <sshegde@...ux.ibm.com>
---
kernel/sched/fair.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 7377f9117501..cd1c78d2c272 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -12447,13 +12447,6 @@ static void nohz_balancer_kick(struct rq *rq)
*/
nohz_balance_exit_idle(rq);
- /*
- * None are in tickless mode and hence no need for NOHZ idle load
- * balancing:
- */
- if (likely(!atomic_read(&nohz.nr_cpus)))
- return;
-
if (READ_ONCE(nohz.has_blocked_load) &&
time_after(now, READ_ONCE(nohz.next_blocked)))
flags = NOHZ_STATS_KICK;
@@ -12461,6 +12454,13 @@ static void nohz_balancer_kick(struct rq *rq)
if (time_before(now, nohz.next_balance))
goto out;
+ /*
+ * None are in tickless mode and hence no need for NOHZ idle load
+ * balancing:
+ */
+ if (likely(!atomic_read(&nohz.nr_cpus)))
+ return;
+
if (rq->nr_running >= 2) {
flags = NOHZ_STATS_KICK | NOHZ_BALANCE_KICK;
goto out;
--
2.47.3
Powered by blists - more mailing lists