From: Thomas Gleixner <tglx@linutronix.de>
To: Zhiqiang Liu <liuzhiqiang26@huawei.com>
Cc: corbet@lwn.net, mcgrof@kernel.org,
Kees Cook <keescook@chromium.org>,
akpm@linux-foundation.org, manfred@colorfullife.com,
jwilk@jwilk.net, dvyukov@google.com, feng.tang@intel.com,
sunilmut@microsoft.com, quentin.perret@arm.com,
linux@leemhuis.info, alex.popov@linux.com,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-fsdevel@vger.kernel.org,
"wangxiaogang (F)" <wangxiaogang3@huawei.com>,
"Zhoukang (A)" <zhoukang7@huawei.com>,
Mingfangsen <mingfangsen@huawei.com>,
tedheadster@gmail.com, Eric Dumazet <edumazet@google.com>
Subject: Re: [PATCH next] softirq: enable MAX_SOFTIRQ_TIME tuning with sysctl max_softirq_time_usecs
Date: Mon, 8 Jul 2019 16:14:41 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.21.1907081558400.4709@nanos.tec.linutronix.de> (raw)
In-Reply-To: <c1b7a345-fa22-e52a-4db8-1f1288e7ad15@huawei.com>
Zhiqiang,
On Tue, 25 Jun 2019, Zhiqiang Liu wrote:
> I have a doubt about _msecs_to_jiffies funcs, especially when input m is
> equal to 0.
>
> For different HZ setttings, different _msecs_to_jiffies funcs will be
> chosen for msecs_to_jiffies func. However, the performance of different
> _msecs_to_jiffies is inconsistent with input m is equal to 0.
>
> If HZ satisfies the condition: HZ <= MSEC_PER_SEC && !(MSEC_PER_SEC %
> HZ), the return value of _msecs_to_jiffies func with m=0 is different
> with different HZ setting.
> ------------------------------------
> | HZ | MSEC_PER_SEC / HZ | return |
> ------------------------------------
> |1000| 1 | 0 |
> |500 | 2 | 1 |
> |200 | 5 | 1 |
> |100 | 10 | 1 |
> ------------------------------------
>
> Why only the return value of HZ=1000 is equal to 0 with m=0 ?
I don't know how you tested that, but obviously all four HZ values use
this variant:
> #if HZ <= MSEC_PER_SEC && !(MSEC_PER_SEC % HZ)
> static inline unsigned long _msecs_to_jiffies(const unsigned int m)
> {
> return (m + (MSEC_PER_SEC / HZ) - 1) / (MSEC_PER_SEC / HZ);
> }
and for all four HZ values the result is 0. Why?
For m = 0 the calculation reduces to:
((MSEC_PER_SEC / HZ) - 1) / (MSEC_PER_SEC / HZ)
i.e.
(x - 1) / x where x = [1, 2, 5, 10]
which is guaranteed to be 0 for integer math. If not, you have a compiler
problem.
Thanks,
tglx
next prev parent reply other threads:[~2019-07-08 14:15 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-20 15:14 Zhiqiang Liu
2019-06-23 16:38 ` Thomas Gleixner
2019-06-24 4:01 ` Zhiqiang Liu
2019-06-24 9:45 ` Thomas Gleixner
2019-06-24 13:32 ` Zhiqiang Liu
2019-06-25 14:46 ` Zhiqiang Liu
2019-07-08 14:14 ` Thomas Gleixner [this message]
2019-07-09 1:25 ` Zhiqiang Liu
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=alpine.DEB.2.21.1907081558400.4709@nanos.tec.linutronix.de \
--to=tglx@linutronix.de \
--cc=akpm@linux-foundation.org \
--cc=alex.popov@linux.com \
--cc=corbet@lwn.net \
--cc=dvyukov@google.com \
--cc=edumazet@google.com \
--cc=feng.tang@intel.com \
--cc=jwilk@jwilk.net \
--cc=keescook@chromium.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@leemhuis.info \
--cc=liuzhiqiang26@huawei.com \
--cc=manfred@colorfullife.com \
--cc=mcgrof@kernel.org \
--cc=mingfangsen@huawei.com \
--cc=quentin.perret@arm.com \
--cc=sunilmut@microsoft.com \
--cc=tedheadster@gmail.com \
--cc=wangxiaogang3@huawei.com \
--cc=zhoukang7@huawei.com \
/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
all inboxes | Powered by JetHome®