[v8,15/25] timer: Split next timer interrupt logic

Message ID 20231004123454.15691-16-anna-maria@linutronix.de
State New
Headers
Series timer: Move from a push remote at enqueue to a pull at expiry model |

Commit Message

Anna-Maria Behnsen Oct. 4, 2023, 12:34 p.m. UTC
  Logic for getting next timer interrupt (no matter of recalculated or
already stored in base->next_expiry) is split into a separate function
"next_timer_interrupt()" to make it available for new call sites.

No functional change.

Signed-off-by: Anna-Maria Behnsen <anna-maria@linutronix.de>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Frederic Weisbecker <frederic@kernel.org>
---
 kernel/time/timer.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
  

Patch

diff --git a/kernel/time/timer.c b/kernel/time/timer.c
index 1aafa0edc74c..7468a805d302 100644
--- a/kernel/time/timer.c
+++ b/kernel/time/timer.c
@@ -1951,14 +1951,20 @@  static u64 cmp_next_hrtimer_event(u64 basem, u64 expires)
 	return DIV_ROUND_UP_ULL(nextevt, TICK_NSEC) * TICK_NSEC;
 }
 
+static unsigned long next_timer_interrupt(struct timer_base *base)
+{
+	if (base->next_expiry_recalc)
+		next_expiry_recalc(base);
+
+	return base->next_expiry;
+}
+
 static inline unsigned long __get_next_timer_interrupt(unsigned long basej,
 						       struct timer_base *base)
 {
 	unsigned long nextevt;
 
-	if (base->next_expiry_recalc)
-		next_expiry_recalc(base);
-	nextevt = base->next_expiry;
+	nextevt = next_timer_interrupt(base);
 
 	if (base->timers_pending) {
 		/* If we missed a tick already, force 0 delta */