lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.21.1907081558400.4709@nanos.tec.linutronix.de>
Date:   Mon, 8 Jul 2019 16:14:41 +0200 (CEST)
From:   Thomas Gleixner <tglx@...utronix.de>
To:     Zhiqiang Liu <liuzhiqiang26@...wei.com>
cc:     corbet@....net, mcgrof@...nel.org,
        Kees Cook <keescook@...omium.org>, akpm@...ux-foundation.org,
        manfred@...orfullife.com, jwilk@...lk.net, dvyukov@...gle.com,
        feng.tang@...el.com, sunilmut@...rosoft.com,
        quentin.perret@....com, linux@...mhuis.info, alex.popov@...ux.com,
        linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-fsdevel@...r.kernel.org,
        "wangxiaogang (F)" <wangxiaogang3@...wei.com>,
        "Zhoukang (A)" <zhoukang7@...wei.com>,
        Mingfangsen <mingfangsen@...wei.com>, tedheadster@...il.com,
        Eric Dumazet <edumazet@...gle.com>
Subject: Re: [PATCH next] softirq: enable MAX_SOFTIRQ_TIME tuning with sysctl
 max_softirq_time_usecs

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ