timers: Rework idle logic
authorThomas Gleixner <tglx@linutronix.de>
Fri, 1 Dec 2023 09:26:33 +0000 (10:26 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Wed, 20 Dec 2023 15:49:39 +0000 (16:49 +0100)
commitbb8caad5083f8fbba70faf41f1d3bab7cf09da6d
tree75128a304b02577d33a6fc2110ed011565ffa138
parent7a39a5080ef0e3cf233d92165f6a778f08a08244
timers: Rework idle logic

To improve readability of the code, split base->idle calculation and
expires calculation into separate parts. While at it, update the comment
about timer base idle marking.

Thereby the following subtle change happens if the next event is just one
jiffy ahead and the tick was already stopped: Originally base->is_idle
remains true in this situation. Now base->is_idle turns to false. This may
spare an IPI if a timer is enqueued remotely to an idle CPU that is going
to tick on the next jiffy.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
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/20231201092654.34614-12-anna-maria@linutronix.de
kernel/time/timer.c