From: Vincent Guittot <vincent.guittot@linaro.org>
To: Jiang Biao <benbjiang@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Juri Lelli <juri.lelli@redhat.com>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
linux-kernel <linux-kernel@vger.kernel.org>,
Jiang Biao <benbjiang@tencent.com>
Subject: Re: [PATCH] sched/fair: avoid vruntime compensation for SCHED_IDLE task
Date: Fri, 28 Aug 2020 14:55:29 +0200 [thread overview]
Message-ID: <CAKfTPtCTd5eihtcg=B0Gu3RUydbSgjurD1uHD3rEvbTV61nf6Q@mail.gmail.com> (raw)
In-Reply-To: <CAPJCdBmbTULFE=tS0-VM9aqKmC0b0PFfny6=UiuVZB=hVW996Q@mail.gmail.com>
On Sun, 23 Aug 2020 at 09:33, Jiang Biao <benbjiang@gmail.com> wrote:
>
> Hi, Vincent and Peter
>
> On Thu, 20 Aug 2020 at 22:09, Vincent Guittot
> <vincent.guittot@linaro.org> wrote:
> >
> > On Thu, 20 Aug 2020 at 15:44, <peterz@infradead.org> wrote:
> > >
> > > > That's been said, not compensating the vruntime for a sched_idle task
> > > > makes sense for me. Even if that will only help for others task in the
> > > > same cfs_rq
> > >
> > > Yeah, but it is worth the extra pointer chasing and branches?
> >
> > For that I let Jiang provides figures to show the worthful
> Using the following configuration for rt-app,
> {
> "tasks" : {
> "task_other" : {
> "instance" : 1, //only 1 instance to be easy to observe
> "cpus" : [2],
> "loop" : 2000,
> "policy" : "SCHED_OTHER",
> "run" : -1, //make normal task 100% running
> "priority" : 0,
> "sleep" : 0
> },
> "task_idle" : {
> "instance" : 1,
> "cpus" : [2],
> "loop" : 2000,
> "policy" : "SCHED_IDLE",
> "run" : 1, //only run 1us to avoid
> blocking(always waiting for running), making check_preempt_wakeup
> work(S->R switching)
> "timer" : { "ref" : "unique2" , "period" :
> 16000, "mode" : "absolute" }
> }
> },
> "global" : {
> "calibration" : "CPU0",
> "default_policy" : "SCHED_OTHER",
> "duration" : -1
> }
> }
> without the patch,
> <...>-39771 [002] d.h. 42478.177771: sched_wakeup:
> comm=task_idle-1 pid=39772 prio=120 target_cpu=002
> <...>-39771 [002] d... 42478.190437: sched_switch:
> prev_comm=task_other-0 prev_pid=39771 prev_prio=120 prev_state=R ==>
> next_comm=task_idle-1 next_pid=39772 next_prio=120
> <...>-39771 [002] d.h. 42478.193771: sched_wakeup:
> comm=task_idle-1 pid=39772 prio=120 target_cpu=002
> <...>-39771 [002] d... 42478.206438: sched_switch:
> prev_comm=task_other-0 prev_pid=39771 prev_prio=120 prev_state=R ==>
> next_comm=task_idle-1 next_pid=39772 next_prio=120
> <...>-39771 [002] d.h. 42478.209771: sched_wakeup:
> comm=task_idle-1 pid=39772 prio=120 target_cpu=002
> <...>-39771 [002] d... 42478.222438: sched_switch:
> prev_comm=task_other-0 prev_pid=39771 prev_prio=120 prev_state=R ==>
> next_comm=task_idle-1 next_pid=39772 next_prio=120
> <...>-39771 [002] d.h. 42478.225771: sched_wakeup:
> comm=task_idle-1 pid=39772 prio=120 target_cpu=002
> <...>-39771 [002] d... 42478.238438: sched_switch:
> prev_comm=task_other-0 prev_pid=39771 prev_prio=120 prev_state=R ==>
> next_comm=task_idle-1 next_pid=39772 next_prio=120
> *task_idle* preempts every 12ms because of the compensation.
>
> with the patch,
> task_other-0-27670 [002] d.h. 136785.278059: sched_wakeup:
> comm=task_idle-1 pid=27671 prio=120 target_cpu=002
> task_other-0-27670 [002] d... 136785.293623: sched_switch:
> prev_comm=task_other-0 prev_pid=27670 prev_prio=120 prev_state=R ==>
> next_comm=task_idle-1 next_pid=27671 next_prio=120
> task_other-0-27670 [002] d.h. 136785.294059: sched_wakeup:
> comm=task_idle-1 pid=27671 prio=120 target_cpu=002
> task_other-0-27670 [002] d... 136785.317624: sched_switch:
> prev_comm=task_other-0 prev_pid=27670 prev_prio=120 prev_state=R ==>
> next_comm=task_idle-1 next_pid=27671 next_prio=120
> task_other-0-27670 [002] d.h. 136785.326059: sched_wakeup:
> comm=task_idle-1 pid=27671 prio=120 target_cpu=002
> task_other-0-27670 [002] d... 136785.341622: sched_switch:
> prev_comm=task_other-0 prev_pid=27670 prev_prio=120 prev_state=R ==>
> next_comm=task_idle-1 next_pid=27671 next_prio=120
> task_other-0-27670 [002] d.h. 136785.342059: sched_wakeup:
> comm=task_idle-1 pid=27671 prio=120 target_cpu=002
> task_other-0-27670 [002] d... 136785.365623: sched_switch:
> prev_comm=task_other-0 prev_pid=27670 prev_prio=120 prev_state=R ==>
> next_comm=task_idle-1 next_pid=27671 next_prio=120
> *task_idle* preempts every 24 or 16 ms.
>
> This patch could reduce the preempting frequency of task_idle, and
> reduce the interference from SCHED_IDLE task.
For this use case, the preemption is only 1us long. Is it a realistic
problem use case ? your normal threads might be more impacted by tick,
interrupt, timer and others things than this 1us idle thread every
16ms. I mean, the patch moves the impact from 1us every 12ms (0.01%)
to 1us every 24ms (0.005%). Then, If the idle thread starts to run a
bit longer, the period before preempting the normal thread quickly
increases
What is the improvement for an idle thread trying to run 1ms every
16ms as an example ?
Regards,
Vincent
>
> Thx.
> Regards,
> Jiang
next prev parent reply other threads:[~2020-08-28 12:55 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-20 12:00 [PATCH] sched/fair: avoid vruntime compensation for SCHED_IDLE task Jiang Biao
2020-08-20 12:51 ` Vincent Guittot
2020-08-20 12:58 ` peterz
2020-08-20 13:15 ` Vincent Guittot
2020-08-20 13:43 ` peterz
2020-08-20 14:09 ` Vincent Guittot
2020-08-20 14:24 ` Jiang Biao
2020-08-23 7:33 ` Jiang Biao
2020-08-28 12:55 ` Vincent Guittot [this message]
2020-09-01 10:14 ` Jiang Biao
2020-09-01 13:04 ` Vincent Guittot
2020-09-01 14:19 ` Jiang Biao
2020-08-20 14:19 ` Jiang Biao
2020-08-20 14:15 ` Jiang Biao
2020-08-21 0:37 ` [sched/fair] 88d13f778f: WARNING:at_kernel/sched/fair.c:#place_entity kernel test robot
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='CAKfTPtCTd5eihtcg=B0Gu3RUydbSgjurD1uHD3rEvbTV61nf6Q@mail.gmail.com' \
--to=vincent.guittot@linaro.org \
--cc=benbjiang@gmail.com \
--cc=benbjiang@tencent.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.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 \
/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).