[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c1b7a345-fa22-e52a-4db8-1f1288e7ad15@huawei.com>
Date: Tue, 25 Jun 2019 22:46:38 +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
Dear Thomas,
On 2019/6/24 17:45, Thomas Gleixner wrote:
> Zhiqiang,
>
> On Mon, 24 Jun 2019, Zhiqiang Liu wrote:
>>
>> Thanks again for your detailed advice.
>> As your said, the max_softirq_time_usecs setting without explaining the
>> relationship with CONFIG_HZ will give a false sense of controlability. And
>> the time accuracy of jiffies will result in a certain difference between the
>> max_softirq_time_usecs set value and the actual value, which is in one jiffies
>> range.
>>
>> I will add these infomation in the sysctl documentation and changelog in v2 patch.
>
> Please make the sysctl milliseconds based. That's the closest approximation
> of useful units for this. This still has the same issues as explained
> before but it's not off by 3 orders of magitude anymore.
>
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 ?
Codes are given as follows,
#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);
}
#elif HZ > MSEC_PER_SEC && !(HZ % MSEC_PER_SEC)
static inline unsigned long _msecs_to_jiffies(const unsigned int m)
{
if (m > jiffies_to_msecs(MAX_JIFFY_OFFSET))
return MAX_JIFFY_OFFSET;
return m * (HZ / MSEC_PER_SEC);
}
#else
static inline unsigned long _msecs_to_jiffies(const unsigned int m)
{
if (HZ > MSEC_PER_SEC && m > jiffies_to_msecs(MAX_JIFFY_OFFSET))
return MAX_JIFFY_OFFSET;
return (MSEC_TO_HZ_MUL32 * m + MSEC_TO_HZ_ADJ32) >> MSEC_TO_HZ_SHR32;
}
> Thanks,
>
> tglx
>
Powered by blists - more mailing lists