diff mbox series

[v3,12/17] timer: Check if timers base is handled already

Message ID 20221025135850.51044-13-anna-maria@linutronix.de
State Accepted
Commit 89f01e10c99a5ca2ff88b545fad763d360cdbfc8
Headers show
Series timer: Move from a push remote at enqueue to a pull at expiry model | expand

Commit Message

Anna-Maria Behnsen Oct. 25, 2022, 1:58 p.m. UTC
Due to the conversion of the NOHZ timer placement to a pull at expiry
time model, the per CPU timer bases with non pinned timers are no
longer handled only by the local CPU. In case a remote CPU already
expires the non pinned timers base of the local cpu, nothing more
needs to be done by the local CPU. A check at the begin of the expire
timers routine is required, because timer base lock is dropped before
executing the timer callback function.

This is a preparatory work, but has no functional impact right now.

Signed-off-by: Anna-Maria Behnsen <anna-maria@linutronix.de>
---
 kernel/time/timer.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/kernel/time/timer.c b/kernel/time/timer.c
index bce2f87d5e70..0790ec8efe82 100644
--- a/kernel/time/timer.c
+++ b/kernel/time/timer.c
@@ -1913,6 +1913,9 @@  static inline void __run_timers(struct timer_base *base)
 
 	lockdep_assert_held(&base->lock);
 
+	if (!!base->running_timer)
+		return;
+
 	while (time_after_eq(jiffies, base->clk) &&
 	       time_after_eq(jiffies, base->next_expiry)) {
 		levels = collect_expired_timers(base, heads);