mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] timers: Remove historical extra jiffie for timeout in msleep()
@ 2024-08-29  7:41 Anna-Maria Behnsen
  2024-08-29  9:34 ` Rafael J. Wysocki
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Anna-Maria Behnsen @ 2024-08-29  7:41 UTC (permalink / raw)
  To: linux-kernel
  Cc: Frederic Weisbecker, Thomas Gleixner, Rafael J . Wysocki, Len Brown

msleep() as well as msleep_interruptible() add a jiffie to the
timeout. This extra jiffie was introduced in former days to ensure timeout
will not happen earlier than specified. But the timer wheel already takes
care during enqueue that timers will not expire earlier than specified.

Remove this extra jiffie in msleep() and msleep_interruptible().

Signed-off-by: Anna-Maria Behnsen <anna-maria@linutronix.de>
---
 kernel/time/timer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/time/timer.c b/kernel/time/timer.c
index 64b0d8a0aa0f..18aa759c3cae 100644
--- a/kernel/time/timer.c
+++ b/kernel/time/timer.c
@@ -2730,7 +2730,7 @@ void __init init_timers(void)
  */
 void msleep(unsigned int msecs)
 {
-	unsigned long timeout = msecs_to_jiffies(msecs) + 1;
+	unsigned long timeout = msecs_to_jiffies(msecs);
 
 	while (timeout)
 		timeout = schedule_timeout_uninterruptible(timeout);
@@ -2744,7 +2744,7 @@ EXPORT_SYMBOL(msleep);
  */
 unsigned long msleep_interruptible(unsigned int msecs)
 {
-	unsigned long timeout = msecs_to_jiffies(msecs) + 1;
+	unsigned long timeout = msecs_to_jiffies(msecs);
 
 	while (timeout && !signal_pending(current))
 		timeout = schedule_timeout_interruptible(timeout);
-- 
2.39.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-08-30  5:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-29  7:41 [PATCH] timers: Remove historical extra jiffie for timeout in msleep() Anna-Maria Behnsen
2024-08-29  9:34 ` Rafael J. Wysocki
2024-08-29 14:29 ` [tip: timers/core] " tip-bot2 for Anna-Maria Behnsen
2024-08-30  5:41 ` [PATCH] " Len Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®