Skip to content

Commit d579cc5

Browse files
KAGA-KOKOgregkh
authored andcommitted
hrtimers: Make hrtimer_update_function() less expensive
commit 2ea97b7 upstream. 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: 8f02e35 ("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 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 6b60113 commit d579cc5

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

include/linux/hrtimer.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,14 +348,15 @@ static inline int hrtimer_callback_running(struct hrtimer *timer)
348348
static inline void hrtimer_update_function(struct hrtimer *timer,
349349
enum hrtimer_restart (*function)(struct hrtimer *))
350350
{
351+
#ifdef CONFIG_PROVE_LOCKING
351352
guard(raw_spinlock_irqsave)(&timer->base->cpu_base->lock);
352353

353354
if (WARN_ON_ONCE(hrtimer_is_queued(timer)))
354355
return;
355356

356357
if (WARN_ON_ONCE(!function))
357358
return;
358-
359+
#endif
359360
timer->function = function;
360361
}
361362

0 commit comments

Comments
 (0)