* [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* Re: [PATCH] timers: Remove historical extra jiffie for timeout in msleep()
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
2 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2024-08-29 9:34 UTC (permalink / raw)
To: Anna-Maria Behnsen
Cc: linux-kernel, Frederic Weisbecker, Thomas Gleixner,
Rafael J . Wysocki, Len Brown
On Thu, Aug 29, 2024 at 9:41 AM Anna-Maria Behnsen
<anna-maria@linutronix.de> wrote:
>
> 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>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
> 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* [tip: timers/core] timers: Remove historical extra jiffie for timeout in msleep()
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-bot2 for Anna-Maria Behnsen
2024-08-30 5:41 ` [PATCH] " Len Brown
2 siblings, 0 replies; 4+ messages in thread
From: tip-bot2 for Anna-Maria Behnsen @ 2024-08-29 14:29 UTC (permalink / raw)
To: linux-tip-commits
Cc: Anna-Maria Behnsen, Thomas Gleixner, Rafael J. Wysocki, x86,
linux-kernel
The following commit has been merged into the timers/core branch of tip:
Commit-ID: 4381b895f544bb84b8cfb34ada64df67c9b2a4f0
Gitweb: https://git.kernel.org/tip/4381b895f544bb84b8cfb34ada64df67c9b2a4f0
Author: Anna-Maria Behnsen <anna-maria@linutronix.de>
AuthorDate: Thu, 29 Aug 2024 09:41:33 +02:00
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Thu, 29 Aug 2024 16:17:18 +02:00
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 <anna-maria@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Link: https://lore.kernel.org/all/20240829074133.4547-1-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 429232d..d8eb368 100644
--- a/kernel/time/timer.c
+++ b/kernel/time/timer.c
@@ -2732,7 +2732,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);
@@ -2746,7 +2746,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);
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] timers: Remove historical extra jiffie for timeout in msleep()
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 ` Len Brown
2 siblings, 0 replies; 4+ messages in thread
From: Len Brown @ 2024-08-30 5:41 UTC (permalink / raw)
To: Anna-Maria Behnsen
Cc: linux-kernel, Frederic Weisbecker, Thomas Gleixner, Rafael J . Wysocki
HZ=250 systems thank you!
Acked-by: Len Brown <len.brown@intel.com>
On Thu, Aug 29, 2024 at 3:41 AM Anna-Maria Behnsen
<anna-maria@linutronix.de> wrote:
>
> 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
>
--
Len Brown, Intel
^ 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®