[10/15] tick: Assume the tick can't be stopped in NOHZ_MODE_INACTIVE mode

Message ID 20240124170459.24850-11-frederic@kernel.org
State New
Headers
Series timers/nohz cleanups and hotplug reorganization |

Commit Message

Frederic Weisbecker Jan. 24, 2024, 5:04 p.m. UTC
  The full-nohz update function checks if the nohz mode is active before
proceeding. It considers one exception though: if the tick is already
stopped even though the nohz mode is inactive, it still moves on in
order to update/restart the tick if needed.

However in order for the tick to be stopped, the nohz_mode has to be
either NOHZ_MODE_LOWRES or NOHZ_MODE_HIGHRES. Therefore it doesn't make
sense to test if the tick is stopped before verifying NOHZ_MODE_INACTIVE
mode.

Remove the needless related condition.

Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
---
 kernel/time/tick-sched.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Thomas Gleixner Jan. 25, 2024, 9:39 a.m. UTC | #1
On Wed, Jan 24 2024 at 18:04, Frederic Weisbecker wrote:
> The full-nohz update function checks if the nohz mode is active before
> proceeding. It considers one exception though: if the tick is already
> stopped even though the nohz mode is inactive, it still moves on in
> order to update/restart the tick if needed.
>
> However in order for the tick to be stopped, the nohz_mode has to be
> either NOHZ_MODE_LOWRES or NOHZ_MODE_HIGHRES. Therefore it doesn't make
> sense to test if the tick is stopped before verifying NOHZ_MODE_INACTIVE
> mode.
>
> Remove the needless related condition.
>
> Signed-off-by: Frederic Weisbecker <frederic@kernel.org>

Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
  

Patch

diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index e8e3b5d447e9..3104fff89007 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -1044,7 +1044,7 @@  static void tick_nohz_full_update_tick(struct tick_sched *ts)
 	if (!tick_nohz_full_cpu(smp_processor_id()))
 		return;
 
-	if (!ts->tick_stopped && ts->nohz_mode == NOHZ_MODE_INACTIVE)
+	if (ts->nohz_mode == NOHZ_MODE_INACTIVE)
 		return;
 
 	__tick_nohz_full_update_tick(ts, ktime_get());