linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zhiqiang Liu <liuzhiqiang26@huawei.com>
To: Thomas Gleixner <tglx@linutronix.de>
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, 24 Jun 2019 12:01:01 +0800	[thread overview]
Message-ID: <0099726a-ead3-bdbe-4c66-c8adc9a4f11b@huawei.com> (raw)
In-Reply-To: <alpine.DEB.2.21.1906231820470.32342@nanos.tec.linutronix.de>


在 2019/6/24 0:38, Thomas Gleixner 写道:
> Zhiqiang,
>> controlled by sysadmins to copy with hardware changes over time.
> 
> So much for the theory. See below.

Thanks for your reply.
> 
>> Correspondingly, the MAX_SOFTIRQ_TIME should be able to be tunned by sysadmins,
>> who knows best about hardware performance, for excepted tradeoff between latence
>> and fairness.
>>
>> Here, we add sysctl variable max_softirq_time_usecs to replace MAX_SOFTIRQ_TIME
>> with 2ms default value.
> 
> ...
> 
>>   */
>> -#define MAX_SOFTIRQ_TIME  msecs_to_jiffies(2)
>> +unsigned int __read_mostly max_softirq_time_usecs = 2000;
>>  #define MAX_SOFTIRQ_RESTART 10
>>
>>  #ifdef CONFIG_TRACE_IRQFLAGS
>> @@ -248,7 +249,8 @@ static inline void lockdep_softirq_end(bool in_hardirq) { }
>>
>>  asmlinkage __visible void __softirq_entry __do_softirq(void)
>>  {
>> -	unsigned long end = jiffies + MAX_SOFTIRQ_TIME;
>> +	unsigned long end = jiffies +
>> +		usecs_to_jiffies(max_softirq_time_usecs);
> 
> That's still jiffies based and therefore depends on CONFIG_HZ. Any budget
> value will be rounded up to the next jiffie. So in case of HZ=100 and
> time=1000us this will still result in 10ms of allowed loop time.
> 
> I'm not saying that we must use a more fine grained time source, but both
> the changelog and the sysctl documentation are misleading.
> 
> If we keep it jiffies based, then microseconds do not make any sense. They
> just give a false sense of controlability.
> 
> Keep also in mind that with jiffies the accuracy depends also on the
> distance to the next tick when 'end' is evaluated. The next tick might be
> imminent.
> 
> That's all information which needs to be in the documentation.
> 

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.

>> +	{
>> +		.procname	= "max_softirq_time_usecs",
>> +		.data		= &max_softirq_time_usecs,
>> +		.maxlen		= sizeof(unsigned int),
>> +		.mode		= 0644,
>> +		.proc_handler   = proc_dointvec_minmax,
>> +		.extra1		= &zero,
>> +	},
> 
> Zero as the lower limit? That means it allows a single loop. Fine, but
> needs to be documented as well.
> 
> Thanks,
> 
> 	tglx
> 
> .
> 


  reply	other threads:[~2019-06-24  4:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-20 15:14 [PATCH next] softirq: enable MAX_SOFTIRQ_TIME tuning with sysctl max_softirq_time_usecs Zhiqiang Liu
2019-06-23 16:38 ` Thomas Gleixner
2019-06-24  4:01   ` Zhiqiang Liu [this message]
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
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=0099726a-ead3-bdbe-4c66-c8adc9a4f11b@huawei.com \
    --to=liuzhiqiang26@huawei.com \
    --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=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=tglx@linutronix.de \
    --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;
as well as URLs for NNTP newsgroup(s).