diff options
| author | Andrea Parri <parri.andrea@gmail.com> | 2026-09-10 16:34:42 +0200 |
|---|---|---|
| committer | Thomas Gleixner <tglx@kernel.org> | 2026-09-11 10:15:42 +0200 |
| commit | c5dcb3aadc18d7b82ba64790721b005d18193d35 (patch) | |
| tree | b0807a6249a8db07a40730e773cea500eeee7b04 /scripts/basic | |
| parent | 113a9796effe3376d2ec5aabcca1fef4fef4cd62 (diff) | |
| download | linux-stable-c5dcb3aadc18d7b82ba64790721b005d18193d35.tar.gz linux-stable-c5dcb3aadc18d7b82ba64790721b005d18193d35.zip | |
hrtimer: Use hard expiry when updating timers on the same base
Rearming a queued timer with nonzero slack can leave the timerqueue out
of order. remove_and_enqueue_same_base() checks the new soft expiry
against its neighbours' hard expiries, then stores the new hard expiry
in the node without requeueing it.
For example, with A at 10 and B at 20, rearming A at 11 with slack 30
passes the neighbour check but leaves A's hard expiry of 41 before B's
20. The same function also caches the soft expiry in base->expires_next
when updating or inserting the first timer, giving next-event selection
an earlier deadline than the queue head's hard expiry.
Set the timer expiry before handling the queue. Use its stored hard
expiry for the in-place ordering check and both updates to
base->expires_next.
The early update is safe because remove_and_enqueue_same_base() runs
with base->cpu_base->lock held. The lock keeps the queue stable while
hrtimer_can_update_in_place() checks the new expiry against both
neighbours. If the check fails, timerqueue_linked_del() removes the node
without comparing expiry values before it is reinserted.
Fixes: eddffab8282e3 ("hrtimer: Keep track of first expiring timer per clock base")
Fixes: 343f2f4dc5425 ("hrtimer: Try to modify timers in place")
Signed-off-by: Andrea Parri <parri.andrea@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Assisted-by: LLM
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20260910143442.2018-1-parri.andrea@gmail.com
Diffstat (limited to 'scripts/basic')
0 files changed, 0 insertions, 0 deletions
