Re: [PATCH next] softirq: enable MAX_SOFTIRQ_TIME tuning with sysctl max_softirq_time_usecs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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.




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux