mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Abel Wu <wuyun.abel@bytedance.com>
To: Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Juri Lelli <juri.lelli@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
	Daniel Bristot de Oliveira <bristot@redhat.com>
Cc: linux-kernel@vger.kernel.org
Subject: [RFC PATCH 5/5] sched/fair: favor cpu capacity for idle tasks
Date: Thu, 17 Feb 2022 23:44:01 +0800	[thread overview]
Message-ID: <20220217154403.6497-6-wuyun.abel@bytedance.com> (raw)
In-Reply-To: <20220217154403.6497-1-wuyun.abel@bytedance.com>

Unlike select_idle_sibling() in which we need to find a
not-so-bad candidate ASAP, the slowpath gives us more
tolerance: ignore sched-idle cpus for idle tasks since
they prefer cpu capacity rather than latency, and besides
spreading out idle tasks also good for latency of normal
tasks.

Signed-off-by: Abel Wu <wuyun.abel@bytedance.com>
---
 kernel/sched/fair.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 1d8f396e6f41..57f1d8c43228 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -6007,6 +6007,7 @@ find_idlest_group(struct sched_domain *sd, struct task_struct *p, int this_cpu);
 static int
 find_idlest_group_cpu(struct sched_group *group, struct task_struct *p, int this_cpu)
 {
+	bool ignore_si = task_h_idle(p);
 	unsigned long load, min_load = ULONG_MAX;
 	unsigned int min_exit_latency = UINT_MAX;
 	u64 latest_idle_timestamp = 0;
@@ -6025,7 +6026,13 @@ find_idlest_group_cpu(struct sched_group *group, struct task_struct *p, int this
 		if (!sched_core_cookie_match(rq, p))
 			continue;
 
-		if (sched_idle_cpu(i))
+		/*
+		 * The idle tasks prefer cpu capacity rather than
+		 * latency. Spreading out idle tasks also good for
+		 * latency of normal tasks since they won't suffer
+		 * high cpu wakeup delay.
+		 */
+		if (!ignore_si && sched_idle_cpu(i))
 			return i;
 
 		if (available_idle_cpu(i)) {
-- 
2.11.0


  parent reply	other threads:[~2022-02-17 15:44 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-17 15:43 [RFC PATCH 0/5] introduce sched-idle balancing Abel Wu
2022-02-17 15:43 ` [RFC PATCH 1/5] sched/fair: record overloaded cpus Abel Wu
2022-02-24  7:10   ` Gautham R. Shenoy
2022-02-24 14:36     ` Abel Wu
2022-02-27  8:08     ` Aubrey Li
2022-02-17 15:43 ` [RFC PATCH 2/5] sched/fair: introduce sched-idle balance Abel Wu
2022-02-17 15:43 ` [RFC PATCH 3/5] sched/fair: add stats for sched-idle balancing Abel Wu
2022-02-17 15:44 ` [RFC PATCH 4/5] sched/fair: filter out overloaded cpus in sis Abel Wu
2022-02-17 15:44 ` Abel Wu [this message]
2022-02-24  3:19 ` [RFC PATCH 0/5] introduce sched-idle balancing Abel Wu
2022-02-24 15:20 ` Peter Zijlstra
2022-02-24 15:29   ` Vincent Guittot
2022-02-25  6:51     ` Abel Wu
2022-02-25  6:46   ` Abel Wu
2022-02-25  8:29     ` Vincent Guittot
2022-02-25 10:46       ` Abel Wu
2022-02-25 13:15         ` Vincent Guittot
2022-02-24 16:47 ` Mel Gorman
2022-02-25  8:15   ` Abel Wu
2022-02-25 10:16     ` Mel Gorman
2022-02-25 13:20       ` Abel Wu
2022-03-02  0:41         ` Josh Don

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=20220217154403.6497-6-wuyun.abel@bytedance.com \
    --to=wuyun.abel@bytedance.com \
    --cc=bristot@redhat.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 \
    --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®