]> git.baikalelectronics.ru Git - kernel.git/commit
hrtimer: Avoid double reprogramming in __hrtimer_start_range_ns()
authorThomas Gleixner <tglx@linutronix.de>
Tue, 13 Jul 2021 13:39:46 +0000 (15:39 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Tue, 10 Aug 2021 15:57:22 +0000 (17:57 +0200)
commit8ac2f02d41d9071f1d679627b8916db79c4829d0
tree23e8119531ade1a40eadee135a62c7a0b900b20a
parentfb7339515c40551e97671ca0b326ff51ca544e5f
hrtimer: Avoid double reprogramming in __hrtimer_start_range_ns()

If __hrtimer_start_range_ns() is invoked with an already armed hrtimer then
the timer has to be canceled first and then added back. If the timer is the
first expiring timer then on removal the clockevent device is reprogrammed
to the next expiring timer to avoid that the pending expiry fires needlessly.

If the new expiry time ends up to be the first expiry again then the clock
event device has to reprogrammed again.

Avoid this by checking whether the timer is the first to expire and in that
case, keep the timer on the current CPU and delay the reprogramming up to
the point where the timer has been enqueued again.

Reported-by: Lorenzo Colitti <lorenzo@google.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20210713135157.873137732@linutronix.de
kernel/time/hrtimer.c