mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-02-19 05:32:22 -05:00
hrtimers: Make hrtimer_update_function() less expensive
The sanity checks in hrtimer_update_function() are expensive for high
frequency usage like in the io/uring code due to locking.
Hide the sanity checks behind CONFIG_PROVE_LOCKING, which has a decent
chance to be enabled on a regular basis for testing.
Fixes: 8f02e3563b ("hrtimers: Introduce hrtimer_update_function()")
Reported-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/87ikpllali.ffs@tglx
This commit is contained in:
@@ -333,6 +333,7 @@ static inline int hrtimer_callback_running(struct hrtimer *timer)
|
||||
static inline void hrtimer_update_function(struct hrtimer *timer,
|
||||
enum hrtimer_restart (*function)(struct hrtimer *))
|
||||
{
|
||||
#ifdef CONFIG_PROVE_LOCKING
|
||||
guard(raw_spinlock_irqsave)(&timer->base->cpu_base->lock);
|
||||
|
||||
if (WARN_ON_ONCE(hrtimer_is_queued(timer)))
|
||||
@@ -340,7 +341,7 @@ static inline void hrtimer_update_function(struct hrtimer *timer,
|
||||
|
||||
if (WARN_ON_ONCE(!function))
|
||||
return;
|
||||
|
||||
#endif
|
||||
timer->function = function;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user