summaryrefslogtreecommitdiff
path: root/kernel/time/hrtimer.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@kernel.org>2026-02-24 17:37:14 +0100
committerPeter Zijlstra <peterz@infradead.org>2026-02-27 16:40:10 +0100
commit8ffc9ea88136903812448a04127e1ee2c0460f24 (patch)
tree9f1680b11119eb557c361a0b7fc37cbbd4c45f6a /kernel/time/hrtimer.c
parent0c6af0ea51bd2774f41a00a81ac276800975c3cc (diff)
downloadlinux-next-8ffc9ea88136903812448a04127e1ee2c0460f24.tar.gz
linux-next-8ffc9ea88136903812448a04127e1ee2c0460f24.zip
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
Diffstat (limited to 'kernel/time/hrtimer.c')
-rw-r--r--kernel/time/hrtimer.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c
index 0448ba9a4ab6..e6f02e980371 100644
--- a/kernel/time/hrtimer.c
+++ b/kernel/time/hrtimer.c
@@ -810,10 +810,11 @@ static void hrtimer_reprogram(struct hrtimer *timer, bool reprogram)
{
struct hrtimer_cpu_base *cpu_base = this_cpu_ptr(&hrtimer_bases);
struct hrtimer_clock_base *base = timer->base;
- ktime_t expires = ktime_sub(hrtimer_get_expires(timer), base->offset);
+ ktime_t expires = hrtimer_get_expires(timer);
- WARN_ON_ONCE(hrtimer_get_expires(timer) < 0);
+ WARN_ON_ONCE(expires < 0);
+ expires = ktime_sub(expires, base->offset);
/*
* CLOCK_REALTIME timer might be requested with an absolute
* expiry time which is less than base->offset. Set it to 0.