]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
posix-timers: Switch to hrtimer_start_expires_user()
authorThomas Gleixner <tglx@kernel.org>
Wed, 8 Apr 2026 11:54:06 +0000 (13:54 +0200)
committerThomas Gleixner <tglx@kernel.org>
Fri, 1 May 2026 19:36:12 +0000 (21:36 +0200)
Switch the arm and rearm callbacks for hrtimer based posix timers over to
hrtimer_start_expires_user() so that already expired timers are not
queued. Hand the result back to the caller, which then queues the signal.

Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Reviewed-by: Frederic Weisbecker <frederic@kernel.org>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20260408114952.266001916@kernel.org
kernel/time/posix-timers.c

index db62cfac169d36f207801e62b2b77b55978a3333..436ba794cc0b584c2d7108db94e6b77acc8d0328 100644 (file)
@@ -293,8 +293,7 @@ static bool common_hrtimer_rearm(struct k_itimer *timr)
        struct hrtimer *timer = &timr->it.real.timer;
 
        timr->it_overrun += hrtimer_forward_now(timer, timr->it_interval);
-       hrtimer_restart(timer);
-       return true;
+       return hrtimer_start_expires_user(timer, HRTIMER_MODE_ABS);
 }
 
 static bool __posixtimer_deliver_signal(struct kernel_siginfo *info, struct k_itimer *timr)
@@ -829,9 +828,11 @@ static bool common_hrtimer_arm(struct k_itimer *timr, ktime_t expires,
                expires = ktime_add_safe(expires, hrtimer_cb_get_time(timer));
        hrtimer_set_expires(timer, expires);
 
-       if (!sigev_none)
-               hrtimer_start_expires(timer, HRTIMER_MODE_ABS);
-       return true;
+       /* For sigev_none pretend that the timer is queued */
+       if (sigev_none)
+               return true;
+
+       return hrtimer_start_expires_user(timer, HRTIMER_MODE_ABS);
 }
 
 static int common_hrtimer_try_to_cancel(struct k_itimer *timr)