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] [day] [month] [year] [list]
Date:   Tue, 9 Jul 2019 09:25:45 +0800
From:   Zhiqiang Liu <liuzhiqiang26@...wei.com>
To:     Thomas Gleixner <tglx@...utronix.de>
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



On 2019/7/8 22:14, Thomas Gleixner wrote:
> Zhiqiang,
> 
>> 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
Thanks for your reply. Actually, I have made a low-level mistake.
I am really sorry for that.
Thanks again.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ