From: Frederic Weisbecker <frederic@kernel.org>
To: "Zhou, Yun" <Yun.Zhou@windriver.com>
Cc: "jstultz@google.com" <jstultz@google.com>,
"tglx@linutronix.de" <tglx@linutronix.de>,
"sboyd@kernel.org" <sboyd@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] timers: fix LVL_START macro
Date: Tue, 15 Nov 2022 23:40:42 +0100 [thread overview]
Message-ID: <20221115224042.GA722789@lothringen> (raw)
In-Reply-To: <SN6PR11MB300812CA336B497C40E93CA19F049@SN6PR11MB3008.namprd11.prod.outlook.com>
On Tue, Nov 15, 2022 at 01:15:11PM +0000, Zhou, Yun wrote:
> Hi Frederic,
>
> The issue now is that a timer may be thrown into the upper level bucket. For example, expires 4090 and 1000 HZ, it should be in level 2, but now it will be placed in the level 3. Is this expected?
>
> * HZ 1000 steps
> * Level Offset Granularity Range
> * 0 0 1 ms 0 ms - 63 ms
> * 1 64 8 ms 64 ms - 511 ms
> * 2 128 64 ms 512 ms - 4095 ms (512ms - ~4s)
> * 3 192 512 ms 4096 ms - 32767 ms (~4s - ~32s)
> * 4 256 4096 ms (~4s) 32768 ms - 262143 ms (~32s - ~4m)
The rule is that a timer is not allowed to expire too early. But it can expire
a bit late. Hence why it is always rounded up. So in the case of 4090, we have
the choice between:
1) expiring at bucket 2 after 4096 - 64 = 4032 ms
2) expiring at bucket 3 after 4096 ms
The 1) rounds down and expires too early. The 2) rounds up and expires a bit
late. So the second solution is preferred.
Thanks.
next prev parent reply other threads:[~2022-11-15 22:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-15 2:56 [PATCH] timers: fix LVL_START macro Yun Zhou
2022-11-15 12:02 ` Frederic Weisbecker
[not found] ` <SN6PR11MB300812CA336B497C40E93CA19F049@SN6PR11MB3008.namprd11.prod.outlook.com>
2022-11-15 22:40 ` Frederic Weisbecker [this message]
2022-11-16 23:48 ` Thomas Gleixner
2022-11-17 12:14 ` Frederic Weisbecker
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=20221115224042.GA722789@lothringen \
--to=frederic@kernel.org \
--cc=Yun.Zhou@windriver.com \
--cc=jstultz@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sboyd@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox