Skip to content

Commit 4381b89

Browse files
anna-marialxKAGA-KOKO
authored andcommitted
timers: Remove historical extra jiffie for timeout in msleep()
msleep() and msleep_interruptible() add a jiffie to the requested timeout. This extra jiffie was introduced to ensure that the timeout will not happen earlier than specified. Since the rework of the timer wheel, the enqueue path already takes care of this. So the extra jiffie added by msleep*() is pointless now. Remove this extra jiffie in msleep() and msleep_interruptible(). Signed-off-by: Anna-Maria Behnsen <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Acked-by: Rafael J. Wysocki <[email protected]> Link: https://lore.kernel.org/all/[email protected]
1 parent ed4fb6d commit 4381b89

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kernel/time/timer.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2732,7 +2732,7 @@ void __init init_timers(void)
27322732
*/
27332733
void msleep(unsigned int msecs)
27342734
{
2735-
unsigned long timeout = msecs_to_jiffies(msecs) + 1;
2735+
unsigned long timeout = msecs_to_jiffies(msecs);
27362736

27372737
while (timeout)
27382738
timeout = schedule_timeout_uninterruptible(timeout);
@@ -2746,7 +2746,7 @@ EXPORT_SYMBOL(msleep);
27462746
*/
27472747
unsigned long msleep_interruptible(unsigned int msecs)
27482748
{
2749-
unsigned long timeout = msecs_to_jiffies(msecs) + 1;
2749+
unsigned long timeout = msecs_to_jiffies(msecs);
27502750

27512751
while (timeout && !signal_pending(current))
27522752
timeout = schedule_timeout_interruptible(timeout);

0 commit comments

Comments
 (0)