[PATCH v5 04/18] timer: Split next timer interrupt logic
From: Anna-Maria Behnsen
Date: Wed Mar 01 2023 - 09:18:24 EST
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@xxxxxxxxxxxxx>
Reviewed-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Reviewed-by: Frederic Weisbecker <frederic@xxxxxxxxxx>
---
kernel/time/timer.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/kernel/time/timer.c b/kernel/time/timer.c
index 08e855727ff8..9e6c2058889b 100644
--- a/kernel/time/timer.c
+++ b/kernel/time/timer.c
@@ -1913,6 +1913,14 @@ 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;
+}
+
/**
* get_next_timer_interrupt - return the time (clock mono) of the next timer
* @basej: base time jiffies
@@ -1939,9 +1947,8 @@ u64 get_next_timer_interrupt(unsigned long basej, u64 basem)
return expires;
raw_spin_lock(&base->lock);
- if (base->next_expiry_recalc)
- next_expiry_recalc(base);
- nextevt = base->next_expiry;
+
+ nextevt = next_timer_interrupt(base);
/*
* We have a fresh next event. Check whether we can forward the
--
2.30.2