[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87ikpllali.ffs@tglx>
Date: Fri, 07 Feb 2025 22:16:09 +0100
From: Thomas Gleixner <tglx@...utronix.de>
To: Jens Axboe <axboe@...nel.dk>, Nam Cao <namcao@...utronix.de>, Anna-Maria
Behnsen <anna-maria@...utronix.de>, Frederic Weisbecker
<frederic@...nel.org>, linux-kernel@...r.kernel.org
Subject: [PATCH] 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: 8f02e3563bb5 ("hrtimers: Introduce hrtimer_update_function()")
Reported-by: Jens Axboe <axboe@...nel.dk>
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
---
include/linux/hrtimer.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -333,6 +333,7 @@ static inline int hrtimer_callback_runni
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_functi
if (WARN_ON_ONCE(!function))
return;
-
+#endif
timer->function = function;
}
Powered by blists - more mailing lists