From: Dietmar Eggemann <dietmar.eggemann@arm.com>
To: Jiang Biao <benbjiang@gmail.com>,
mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com,
vincent.guittot@linaro.org
Cc: rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de,
linux-kernel@vger.kernel.org, Jiang Biao <benbjiang@tencent.com>
Subject: Re: [PATCH] sched/fair: reduce preemption with IDLE tasks runable
Date: Mon, 3 Aug 2020 10:16:37 +0200 [thread overview]
Message-ID: <5ed0fd46-3a3d-3c1a-5d75-03a74864e640@arm.com> (raw)
In-Reply-To: <20200801023248.90104-1-benbjiang@gmail.com>
On 01/08/2020 04:32, Jiang Biao wrote:
> From: Jiang Biao <benbjiang@tencent.com>
>
> No need to preempt when there are only one runable CFS task with
> other IDLE tasks on runqueue. The only one CFS task would always
> be picked in that case.
>
> Signed-off-by: Jiang Biao <benbjiang@tencent.com>
> ---
> kernel/sched/fair.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 04fa8dbcfa4d..8fb80636b010 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -4527,7 +4527,7 @@ entity_tick(struct cfs_rq *cfs_rq, struct sched_entity *curr, int queued)
> return;
> #endif
>
> - if (cfs_rq->nr_running > 1)
> + if (cfs_rq->nr_running > cfs_rq.idle_h_nr_running + 1)
cfs_rq is a pointer.
> check_preempt_tick(cfs_rq, curr);
> }
You can't compare cfs_rq->nr_running with cfs_rq->idle_h_nr_running!
There is a difference between cfs_rq->h_nr_running and
cfs_rq->nr_running. The '_h_' stands for hierarchical.
The former gives you hierarchical task accounting whereas the latter is
the number of sched entities (representing tasks or taskgroups) enqueued
in cfs_rq.
In entity_tick(), cfs_rq->nr_running has to be used for the condition to
call check_preempt_tick(). We want to check if curr has to be preempted
by __pick_first_entity(cfs_rq) on this cfs_rq.
entity_tick() is called for each sched entity (and so for each
cfs_rq_of(se)) of the task group hierarchy (e.g. task p running in
taskgroup /A/B : se(p) -> se(A/B) -> se(A)).
next prev parent reply other threads:[~2020-08-03 8:16 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-01 2:32 Jiang Biao
2020-08-03 8:16 ` Dietmar Eggemann [this message]
2020-08-03 11:26 ` [PATCH] sched/fair: reduce preemption with IDLE tasks runable(Internet mail) benbjiang(蒋彪)
2020-08-06 13:29 ` Dietmar Eggemann
2020-08-06 15:52 ` benbjiang(蒋彪)
2020-08-10 13:24 ` Dietmar Eggemann
2020-08-11 0:41 ` benbjiang(蒋彪)
2020-08-11 15:54 ` Dietmar Eggemann
2020-08-12 3:19 ` benbjiang(蒋彪)
2020-08-12 18:39 ` Dietmar Eggemann
2020-08-13 23:55 ` benbjiang(蒋彪)
2020-08-17 8:57 ` Dietmar Eggemann
2020-08-17 12:05 ` benbjiang(蒋彪)
2020-08-19 10:46 ` Dietmar Eggemann
2020-08-19 11:05 ` Vincent Guittot
2020-08-19 11:55 ` Dietmar Eggemann
2020-08-19 14:27 ` benbjiang(蒋彪)
2020-08-19 14:55 ` Vincent Guittot
2020-08-20 0:13 ` benbjiang(蒋彪)
2020-08-20 7:35 ` Vincent Guittot
2020-08-20 11:27 ` benbjiang(蒋彪)
2020-08-20 12:45 ` Vincent Guittot
2020-08-20 14:28 ` Jiang Biao
2020-08-20 14:36 ` Vincent Guittot
2020-08-21 0:14 ` Jiang Biao
2020-08-19 14:10 ` benbjiang(蒋彪)
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=5ed0fd46-3a3d-3c1a-5d75-03a74864e640@arm.com \
--to=dietmar.eggemann@arm.com \
--cc=benbjiang@gmail.com \
--cc=benbjiang@tencent.com \
--cc=bsegall@google.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=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
all inboxes | Powered by JetHome®