timers: Restructure get_next_timer_interrupt()
authorAnna-Maria Behnsen <anna-maria@linutronix.de>
Wed, 21 Feb 2024 09:05:29 +0000 (10:05 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Thu, 22 Feb 2024 16:52:30 +0000 (17:52 +0100)
get_next_timer_interrupt() contains two parts for the next timer interrupt
calculation. Those two parts are separated by forwarding the base
clock. But the second part does not depend on the forwarded base
clock.

Therefore restructure get_next_timer_interrupt() to keep things together
which belong together.

No functional change.

Signed-off-by: Anna-Maria Behnsen <anna-maria@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Frederic Weisbecker <frederic@kernel.org>
Link: https://lore.kernel.org/r/20240221090548.36600-2-anna-maria@linutronix.de
kernel/time/timer.c

index d44dba1d4af0ddc1ef7e89eef810cf86423aee43..316ded68fa0640c8888fec70cbd8ba1378a887c6 100644 (file)
@@ -1982,12 +1982,6 @@ u64 get_next_timer_interrupt(unsigned long basej, u64 basem)
        if (base->next_expiry_recalc)
                next_expiry_recalc(base);
 
-       /*
-        * We have a fresh next event. Check whether we can forward the
-        * base.
-        */
-       __forward_timer_base(base, basej);
-
        if (base->timers_pending) {
                nextevt = base->next_expiry;
 
@@ -2005,6 +1999,12 @@ u64 get_next_timer_interrupt(unsigned long basej, u64 basem)
                base->next_expiry = nextevt;
        }
 
+       /*
+        * We have a fresh next event. Check whether we can forward the
+        * base.
+        */
+       __forward_timer_base(base, basej);
+
        /*
         * Base is idle if the next event is more than a tick away.
         *