public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] time/tick-sched: enable idle load balancing when nohz_full cpu becomes idle.
@ 2024-05-06 21:31 Levi Yun
  2024-05-08  9:18 ` Markus Elfring
  2024-05-08 17:26 ` [PATCH v2] time/tick-sched: " Levi Yun
  0 siblings, 2 replies; 31+ messages in thread
From: Levi Yun @ 2024-05-06 21:31 UTC (permalink / raw)
  To: anna-maria, frederic, mingo, tglx; +Cc: linux-kernel, Levi Yun

When nohz_full CPU stops tick in tick_nohz_irq_exit(),
It wouldn't be chosen to perform idle load balancing bacause it doesn't
call nohz_balance_enter_idle() in tick_nohz_idle_stop_tick() when it
becomes idle.

tick_nohz_idle_stop_tick() is only called in idle state and
nohz_balance_enter_idle() tracks the CPU is part of nohz.idle_cpus_mask
with rq->nohz_tick_stopped.

So, nohz_balance_enter_idle() could be called safely without !was_stooped
check.

Signed-off-by: Levi Yun <ppbuk5246@gmail.com>
---
 kernel/time/tick-sched.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index 71a792cd8936..31a4cd89782f 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -1228,8 +1228,10 @@ void tick_nohz_idle_stop_tick(void)
 		ts->idle_sleeps++;
 		ts->idle_expires = expires;

-		if (!was_stopped && tick_sched_flag_test(ts, TS_FLAG_STOPPED)) {
-			ts->idle_jiffies = ts->last_jiffies;
+		if (tick_sched_flag_test(ts, TS_FLAG_STOPPED)) {
+			if (!was_stopped)
+				ts->idle_jiffies = ts->last_jiffies;
+
 			nohz_balance_enter_idle(cpu);
 		}
 	} else {
--
2.41.0

^ permalink raw reply related	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2024-05-17 14:50 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-06 21:31 [PATCH] time/tick-sched: enable idle load balancing when nohz_full cpu becomes idle Levi Yun
2024-05-08  9:18 ` Markus Elfring
2024-05-09  9:59   ` Dan Carpenter
2024-05-08 17:26 ` [PATCH v2] time/tick-sched: " Levi Yun
2024-05-08 18:38   ` Markus Elfring
2024-05-08 19:15     ` Yun Levi
2024-05-08 19:22   ` [PATCH v3] " Levi Yun
2024-05-09  6:28     ` Markus Elfring
2024-05-09  7:26       ` Yun Levi
2024-05-09  8:16         ` Markus Elfring
2024-05-09  9:22           ` Yun Levi
2024-05-09  9:40             ` [v3] " Markus Elfring
2024-05-09  9:29   ` [PATCH v4] " Levi Yun
2024-05-09  9:55     ` [v4] " Markus Elfring
2024-05-15 16:41     ` [PATCH v4] " Yun Levi
2024-05-15 22:52     ` Frederic Weisbecker
2024-05-16  5:29       ` Yun Levi
2024-05-16  7:56       ` Peter Zijlstra
2024-05-16  8:20         ` Yun Levi
2024-05-16  8:49           ` Peter Zijlstra
2024-05-16 11:25             ` Frederic Weisbecker
2024-05-16 12:43               ` Yun Levi
2024-05-16 14:00                 ` Peter Zijlstra
2024-05-16 14:23                   ` Frederic Weisbecker
2024-05-16 14:45                     ` Peter Zijlstra
2024-05-16 15:02                       ` Frederic Weisbecker
2024-05-16 15:19                         ` Peter Zijlstra
2024-05-16 15:32                           ` Frederic Weisbecker
2024-05-16 16:12                             ` Yun Levi
2024-05-16 17:53                             ` Peter Zijlstra
2024-05-17 14:50                               ` Frederic Weisbecker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox