Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

hrtimer: Evaluate timer expiry only once

No point in accessing the timer twice.

Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20260224163430.409352042@kernel.org

authored by

Thomas Gleixner and committed by
Peter Zijlstra
8ffc9ea8 0c6af0ea

+3 -2
+3 -2
kernel/time/hrtimer.c
··· 810 810 { 811 811 struct hrtimer_cpu_base *cpu_base = this_cpu_ptr(&hrtimer_bases); 812 812 struct hrtimer_clock_base *base = timer->base; 813 - ktime_t expires = ktime_sub(hrtimer_get_expires(timer), base->offset); 813 + ktime_t expires = hrtimer_get_expires(timer); 814 814 815 - WARN_ON_ONCE(hrtimer_get_expires(timer) < 0); 815 + WARN_ON_ONCE(expires < 0); 816 816 817 + expires = ktime_sub(expires, base->offset); 817 818 /* 818 819 * CLOCK_REALTIME timer might be requested with an absolute 819 820 * expiry time which is less than base->offset. Set it to 0.