timers: Initialize base::next_expiry_recalc in timers_prepare_cpu()
authorAnna-Maria Behnsen <anna-maria@linutronix.de>
Tue, 5 Apr 2022 19:17:31 +0000 (21:17 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Sat, 9 Apr 2022 20:19:39 +0000 (22:19 +0200)
When base::next_expiry_recalc is not initialized to false during cpu
bringup in HOTPLUG_CPU and is accidently true and no timer is queued in the
meantime, the loop through the wheel to find __next_timer_interrupt() might
be done for nothing.

Therefore initialize base::next_expiry_recalc to false in
timers_prepare_cpu().

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/20220405191732.7438-2-anna-maria@linutronix.de
kernel/time/timer.c

index 9dd2a39..204d6cd 100644 (file)
@@ -1953,6 +1953,7 @@ int timers_prepare_cpu(unsigned int cpu)
                base = per_cpu_ptr(&timer_bases[b], cpu);
                base->clk = jiffies;
                base->next_expiry = base->clk + NEXT_TIMER_MAX_DELTA;
+               base->next_expiry_recalc = false;
                base->timers_pending = false;
                base->is_idle = false;
        }