All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anna-Maria Behnsen <anna-maria@linutronix.de>
To: Len Brown <lenb@kernel.org>, "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	linux-acpi@vger.kernel.org, linux-pm@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Frederic Weisbecker <frederic@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Jonathan Corbet <corbet@lwn.net>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] ACPI: Remove msleep() bloat from acpi_os_sleep()
Date: Thu, 29 Aug 2024 10:04:32 +0200	[thread overview]
Message-ID: <87ikvjah67.fsf@somnus> (raw)
In-Reply-To: <87frqoig98.fsf@somnus>

Anna-Maria Behnsen <anna-maria@linutronix.de> writes:

[...]

> Lets have a deeper look to msleep() internals: msleep() uses timer list
> timers. Because of the design of the timer wheel (granularity of buckets
> increases with the levels) and because of the granularity of jiffies the
> sleep values will be longer as specified. Let's assume we are executing
> a msleep(1) on a HZ=250 system:
>
> First msecs are mapped on jiffies, so this results in a 4ms timeout
> value, as there is nothing shorter than 1 jiffie. Then the jiffie value
> is handed over to timer code and msleep() adds another jiffie to the
> timeout. The timeout is then 2 jiffies or 8ms. With this timeout a timer
> list timer is queued. To make sure that timers will not fire early or
> race with a concurrent incrementation of jiffie, timers are queued
> always into the next bucket. As the timer will end up in the first level
> of the timer wheel the granularity of the buckets is 1 jiffies. This
> means that the timeout would be 3 jiffies in worst case.
>
> The additional jiffie in msleep() is the historical prevention that the
> sleep time is at least the specified time. This is handled by timer
> wheel core code itself, so this extra jiffie could be removed. I will
> provide a patch for it.

I missed to use the whole cc list above when sending the patch:

  https://lore.kernel.org/r/20240829074133.4547-1-anna-maria@linutronix.de/

Thanks,

	Anna-Maria


      parent reply	other threads:[~2024-08-29  8:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-27  3:35 [PATCH] ACPI: Remove msleep() bloat from acpi_os_sleep() Len Brown
2024-08-27 11:29 ` Rafael J. Wysocki
2024-08-28  4:06   ` Len Brown
2024-08-28 10:58     ` Rafael J. Wysocki
2024-08-28 13:35       ` Rafael J. Wysocki
     [not found]         ` <CAJvTdK=-ETniiwzwLYH14+TeU0kA49gvTnqyRxH7-Hc6tzTBUw@mail.gmail.com>
     [not found]           ` <CAJvTdKmpfs_nh4J0R8T=1P9WaAJ-nJ+mKj=rT3tqMpmvpUTisA@mail.gmail.com>
2024-08-28 19:44             ` Anna-Maria Behnsen
2024-08-28 20:29               ` Rafael J. Wysocki
2024-08-29 15:36                 ` Anna-Maria Behnsen
     [not found]                   ` <CAJvTdKmbwtrUmCAJxXb7UVJuVAyMLec2AF--AHbiy+YNhOg5-Q@mail.gmail.com>
2024-08-30 13:56                     ` Rafael J. Wysocki
     [not found]                       ` <CAJvTdKm+w_VZ9TQ5bw6=2G4N7CR9xn2qLYAb+p96jC66BXFFug@mail.gmail.com>
2024-11-15 21:45                         ` Rafael J. Wysocki
     [not found]                           ` <CAJvTdKmHGJZ8kkoNc2CefW_j5oa-SB4eCqghF-tuab39XyqNUA@mail.gmail.com>
2024-11-18 10:07                             ` Rafael J. Wysocki
2024-08-29  8:04               ` Anna-Maria Behnsen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ikvjah67.fsf@somnus \
    --to=anna-maria@linutronix.de \
    --cc=akpm@linux-foundation.org \
    --cc=corbet@lwn.net \
    --cc=frederic@kernel.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=rafael@kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.