linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chengming Zhou <zhouchengming@bytedance.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: mingo@redhat.com, juri.lelli@redhat.com,
	vincent.guittot@linaro.org, dietmar.eggemann@arm.com,
	rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de,
	bristot@redhat.com, linux-kernel@vger.kernel.org,
	duanxiongchun@bytedance.com, songmuchun@bytedance.com,
	Frederic Weisbecker <fweisbec@gmail.com>
Subject: Re: [External] Re: [PATCH] sched/fair: fix broken bandwidth control with nohz_full
Date: Mon, 28 Mar 2022 23:40:25 +0800	[thread overview]
Message-ID: <6fc49cff-f8a1-8b09-5a25-a64e5d07d258@bytedance.com> (raw)
In-Reply-To: <YkHRmv/OcABIB0wP@hirez.programming.kicks-ass.net>

On 2022/3/28 23:17, Peter Zijlstra wrote:
> On Mon, Mar 28, 2022 at 09:50:05PM +0800, Chengming Zhou wrote:
>> On 2022/3/28 21:20, Peter Zijlstra wrote:
>>> On Mon, Mar 28, 2022 at 07:07:51PM +0800, Chengming Zhou wrote:
>>>> With nohz_full enabled on cpu, the scheduler_tick() will be stopped
>>>> when only one CFS task left on rq.
>>>>
>>>> scheduler_tick()
>>>>   task_tick_fair()
>>>>     entity_tick()
>>>>       update_curr()
>>>>         account_cfs_rq_runtime(cfs_rq, delta_exec) --> stopped
>>>>
>>>> So that running task can't account its runtime periodically, but
>>>> the cfs_bandwidth hrtimer still __refill_cfs_bandwidth_runtime()
>>>> periodically. Later in one period, the task would account very
>>>> big delta_exec, which cause the cfs_rq to be throttled for a
>>>> long time.
>>>>
>>>> There are two solutions for the problem, the first is that we
>>>> can check in sched_can_stop_tick() if current task's cfs_rq
>>>> have runtime_enabled, in which case we don't stop tick. But
>>>> it will make nohz_full almost useless in cloud environment
>>>> that every container has the cpu bandwidth control setting.
>>>
>>> How is NOHZ_FULL useful in that environment to begin with? If you set
>>> bandwidth crap, the expectation is that there is overcommit, which more
>>> or less assumes lots of scheduling, presumably VMs or somesuch crud.
>>>
>>> So how does NOHZ_FULL make sense?
>>
>> Yes, we have scheduled some VMs in cgroups on the host, which
>> enabled NOHZ_FULL to reduce the interference of tick to vcpu task
>> if it's the only task running on cpu.
>>
>> This problem will however throttle it wrongly, even if it hasn't
>> used up its quota.
>>
>> Do you suggest that we shouldn't stop tick when the current task's
>> cfs_rq has runtime_enabled ?
> 
> I'm not suggesting anything just yet as I'm not sure I understand things
> well enough. I'm just wondering if NOHZ_FULL makes sense for you since
> NOHZ_FULL makes system entry/exit so much more expensive.

Ok, I see. It seems a normal use-case that run VMs on system with NOHZ_FULL
enabled, and set bandwidth for overcommit. At some times, the cpu will
stop tick when low load.

> 
> NOHZ_FULL is for use-cases that 'never' intend to go into the kernel,
> your use-case actively relies on going into the kernel. Hence the
> confusion.

In fact, I put a testcase at the end of git message, in which only run
a userspace loop workload:

cd /sys/fs/cgroup
echo "+cpu" > cgroup.subtree_control

mkdir test
echo "105000 100000" > test/cpu.max

echo $$ > test/cgroup.procs
taskset -c 1 bash -c "while true; do let i++; done"  --> will be throttled

Thanks.


  reply	other threads:[~2022-03-28 15:41 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-28 11:07 [PATCH] sched/fair: fix broken bandwidth control with nohz_full Chengming Zhou
2022-03-28 13:20 ` Peter Zijlstra
2022-03-28 13:50   ` [External] " Chengming Zhou
2022-03-28 15:17     ` Peter Zijlstra
2022-03-28 15:40       ` Chengming Zhou [this message]
2022-03-28 15:56         ` Peter Zijlstra
2022-03-28 16:35           ` Chengming Zhou
2022-03-28 16:44           ` Steven Rostedt
2022-03-29  2:58             ` Chengming Zhou
2022-03-30 18:23             ` Peter Zijlstra
2022-03-30 18:37               ` Steven Rostedt
2022-03-30 19:14               ` Phil Auld
2022-04-01  7:05                 ` Chengming Zhou
2022-03-28 19:05 ` Benjamin Segall
2022-03-29  3:36   ` [External] " Chengming Zhou

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=6fc49cff-f8a1-8b09-5a25-a64e5d07d258@bytedance.com \
    --to=zhouchengming@bytedance.com \
    --cc=bristot@redhat.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=duanxiongchun@bytedance.com \
    --cc=fweisbec@gmail.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=songmuchun@bytedance.com \
    --cc=vincent.guittot@linaro.org \
    /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).