]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
hrtimer: Avoid pointless reprogramming in __hrtimer_start_range_ns()
authorPeter Zijlstra <peterz@infradead.org>
Tue, 24 Feb 2026 16:35:37 +0000 (17:35 +0100)
committerPeter Zijlstra <peterz@infradead.org>
Fri, 27 Feb 2026 15:40:04 +0000 (16:40 +0100)
Much like hrtimer_reprogram(), skip programming if the cpu_base is running
the hrtimer interrupt.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Juri Lelli <juri.lelli@redhat.com>
Reviewed-by: Thomas Gleixner <tglx@kernel.org>
Link: https://patch.msgid.link/20260224163429.069535561@kernel.org
kernel/time/hrtimer.c

index 860af7a584289aee8ab382f5de2c05aa72083724..3088db419aa663203f0d3cd1df308265778f9499 100644 (file)
@@ -1269,6 +1269,14 @@ static int __hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim,
        }
 
        first = enqueue_hrtimer(timer, new_base, mode);
+
+       /*
+        * If the hrtimer interrupt is running, then it will reevaluate the
+        * clock bases and reprogram the clock event device.
+        */
+       if (new_base->cpu_base->in_hrtirq)
+               return false;
+
        if (!force_local) {
                /*
                 * If the current CPU base is online, then the timer is