]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
hrtimer: Push reprogramming timers into the interrupt return path
authorPeter Zijlstra <peterz@infradead.org>
Tue, 24 Feb 2026 16:38:18 +0000 (17:38 +0100)
committerPeter Zijlstra <peterz@infradead.org>
Fri, 27 Feb 2026 15:40:14 +0000 (16:40 +0100)
commit15dd3a9488557d3e6ebcecacab79f4e56b69ab54
tree7f4cfb4c019c6c63e617035e296456dae1b5d15d
parentb0a44fa5e2a22ff67752bbc08c651a2efac3e5fe
hrtimer: Push reprogramming timers into the interrupt return path

Currently hrtimer_interrupt() runs expired timers, which can re-arm
themselves, after which it computes the next expiration time and
re-programs the hardware.

However, things like HRTICK, a highres timer driving preemption, cannot
re-arm itself at the point of running, since the next task has not been
determined yet. The schedule() in the interrupt return path will switch to
the next task, which then causes a new hrtimer to be programmed.

This then results in reprogramming the hardware at least twice, once after
running the timers, and once upon selecting the new task.

Notably, *both* events happen in the interrupt.

By pushing the hrtimer reprogram all the way into the interrupt return
path, it runs after schedule() picks the new task and the double reprogram
can be avoided.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20260224163431.273488269@kernel.org
include/asm-generic/thread_info_tif.h
include/linux/hrtimer_rearm.h
kernel/time/Kconfig
kernel/time/hrtimer.c