From: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
To: "Peter Zijlstra (Intel)" <peterz@infradead.org>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>
Cc: Ricardo Neri <ricardo.neri@intel.com>,
"Ravi V. Shankar" <ravi.v.shankar@intel.com>,
Ben Segall <bsegall@google.com>,
Daniel Bristot de Oliveira <bristot@redhat.com>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Len Brown <len.brown@intel.com>, Mel Gorman <mgorman@suse.de>,
"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
Steven Rostedt <rostedt@goodmis.org>,
Tim Chen <tim.c.chen@linux.intel.com>,
Valentin Schneider <vschneid@redhat.com>,
Ionela Voinescu <ionela.voinescu@arm.com>,
x86@kernel.org, linux-kernel@vger.kernel.org,
Ricardo Neri <ricardo.neri-calderon@linux.intel.com>,
"Tim C . Chen" <tim.c.chen@intel.com>
Subject: [PATCH v3 06/10] sched/fair: Use the prefer_sibling flag of the current sched domain
Date: Mon, 6 Feb 2023 20:58:34 -0800 [thread overview]
Message-ID: <20230207045838.11243-7-ricardo.neri-calderon@linux.intel.com> (raw)
In-Reply-To: <20230207045838.11243-1-ricardo.neri-calderon@linux.intel.com>
SD_PREFER_SIBLING is set from the SMT scheduling domain up to the first
non-NUMA domain (the exception is systems with SD_ASYM_CPUCAPACITY).
Above the SMT sched domain, all domains have a child. The SD_PREFER_
SIBLING is honored always regardless of the scheduling domain at which the
load balance takes place.
There are cases, however, in which the busiest CPU's sched domain has
child but the destination CPU's does not. Consider, for instance a non-SMT
core (or an SMT core with only one online sibling) doing load balance with
an SMT core at the MC level. SD_PREFER_SIBLING will not be honored. We are
left with a fully busy SMT core and an idle non-SMT core.
Avoid inconsistent behavior. Use the prefer_sibling behavior at the current
scheduling domain, not its child.
The NUMA sched domain does not have the SD_PREFER_SIBLING flag. Thus, we
will not spread load among NUMA sched groups, as desired.
Cc: Ben Segall <bsegall@google.com>
Cc: Daniel Bristot de Oliveira <bristot@redhat.com>
Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>
Cc: Len Brown <len.brown@intel.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Tim C. Chen <tim.c.chen@intel.com>
Cc: Valentin Schneider <vschneid@redhat.com>
Cc: x86@kernel.org
Cc: linux-kernel@vger.kernel.org
Suggested-by: Valentin Schneider <vschneid@redhat.com>
Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
---
Changes since v2:
* Introduced this patch.
Changes since v1:
* N/A
---
kernel/sched/fair.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index df7bcbf634a8..a37ad59f20ea 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -10004,7 +10004,6 @@ static void update_idle_cpu_scan(struct lb_env *env,
static inline void update_sd_lb_stats(struct lb_env *env, struct sd_lb_stats *sds)
{
- struct sched_domain *child = env->sd->child;
struct sched_group *sg = env->sd->groups;
struct sg_lb_stats *local = &sds->local_stat;
struct sg_lb_stats tmp_sgs;
@@ -10045,9 +10044,11 @@ static inline void update_sd_lb_stats(struct lb_env *env, struct sd_lb_stats *sd
sg = sg->next;
} while (sg != env->sd->groups);
- /* Tag domain that child domain prefers tasks go to siblings first */
- sds->prefer_sibling = child && child->flags & SD_PREFER_SIBLING;
-
+ /*
+ * Tag domain that @env::sd prefers to spread excess tasks among
+ * sibling sched groups.
+ */
+ sds->prefer_sibling = env->sd->flags & SD_PREFER_SIBLING;
if (env->sd->flags & SD_NUMA)
env->fbq_type = fbq_classify_group(&sds->busiest_stat);
@@ -10346,7 +10347,6 @@ static struct sched_group *find_busiest_group(struct lb_env *env)
goto out_balanced;
}
- /* Try to move all excess tasks to child's sibling domain */
if (sds.prefer_sibling && local->group_type == group_has_spare &&
busiest->sum_nr_running > local->sum_nr_running + 1)
goto force_balance;
--
2.25.1
next prev parent reply other threads:[~2023-02-07 4:51 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-07 4:58 [PATCH v3 00/10] sched/fair: Avoid unnecessary migrations within SMT domains Ricardo Neri
2023-02-07 4:58 ` [PATCH v3 01/10] sched/fair: Generalize asym_packing logic for SMT cores Ricardo Neri
2023-02-07 4:58 ` [PATCH v3 02/10] sched/fair: Move is_core_idle() out of CONFIG_NUMA Ricardo Neri
2023-02-07 4:58 ` [PATCH v3 03/10] sched/fair: Only do asym_packing load balancing from fully idle SMT cores Ricardo Neri
2023-02-07 4:58 ` [PATCH v3 04/10] sched/fair: Let low-priority cores help high-priority busy " Ricardo Neri
2023-02-08 7:56 ` Vincent Guittot
2023-02-09 11:53 ` Peter Zijlstra
2023-02-10 0:43 ` Ricardo Neri
2023-02-10 8:41 ` Peter Zijlstra
2023-02-10 13:05 ` Ricardo Neri
2023-02-10 1:52 ` Ricardo Neri
2023-02-13 13:40 ` Dietmar Eggemann
2023-02-13 23:23 ` Ricardo Neri
2023-03-10 0:51 ` Tim Chen
2023-03-14 23:54 ` Ricardo Neri
2023-02-07 4:58 ` [PATCH v3 05/10] sched/fair: Keep a fully_busy SMT sched group as busiest Ricardo Neri
2023-02-07 4:58 ` Ricardo Neri [this message]
2023-02-08 7:48 ` [PATCH v3 06/10] sched/fair: Use the prefer_sibling flag of the current sched domain Vincent Guittot
2023-02-10 13:24 ` Ricardo Neri
2023-02-09 13:17 ` Chen Yu
2023-02-09 20:00 ` Chen, Tim C
2023-02-09 23:05 ` Tim Chen
2023-02-10 3:16 ` Ricardo Neri
2023-02-10 6:55 ` Chen Yu
2023-02-10 10:08 ` Peter Zijlstra
2023-02-10 14:54 ` Valentin Schneider
2023-02-10 16:53 ` Peter Zijlstra
2023-02-10 17:12 ` Valentin Schneider
2023-02-10 18:31 ` Ricardo Neri
2023-02-13 12:17 ` Dietmar Eggemann
2023-02-14 6:43 ` Ricardo Neri
2023-02-16 5:21 ` Ricardo Neri
2023-02-16 12:16 ` Peter Zijlstra
2023-02-17 1:41 ` Ricardo Neri
2023-02-23 10:09 ` Dietmar Eggemann
2023-02-24 12:29 ` Ricardo Neri
[not found] ` <tencent_60A804570F09C0CFE0495D5B984941123A05@qq.com>
2023-02-20 9:45 ` Valentin Schneider
[not found] ` <tencent_6C38D389245FD03C6E1312999FEDD394F606@qq.com>
2023-02-21 18:15 ` Valentin Schneider
2023-02-07 4:58 ` [PATCH v3 07/10] sched/fair: Do not even the number of busy CPUs via asym_packing Ricardo Neri
2023-02-13 12:44 ` Dietmar Eggemann
2023-02-13 19:47 ` Ricardo Neri
2023-02-07 4:58 ` [PATCH v3 08/10] sched/topology: Remove SHARED_CHILD from ASYM_PACKING Ricardo Neri
2023-03-03 11:29 ` Ionela Voinescu
2023-03-05 19:08 ` Ricardo Neri
2023-03-06 13:10 ` Ionela Voinescu
2023-03-06 18:17 ` Ricardo Neri
2023-02-07 4:58 ` [PATCH v3 09/10] x86/sched: Remove SD_ASYM_PACKING from the SMT domain flags Ricardo Neri
2023-02-07 4:58 ` [PATCH v3 10/10] x86/sched/itmt: Give all SMT siblings of a core the same priority Ricardo Neri
2023-02-09 8:07 ` [PATCH v3 00/10] sched/fair: Avoid unnecessary migrations within SMT domains Zhang, Rui
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=20230207045838.11243-7-ricardo.neri-calderon@linux.intel.com \
--to=ricardo.neri-calderon@linux.intel.com \
--cc=bristot@redhat.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=ionela.voinescu@arm.com \
--cc=juri.lelli@redhat.com \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=peterz@infradead.org \
--cc=rafael.j.wysocki@intel.com \
--cc=ravi.v.shankar@intel.com \
--cc=ricardo.neri@intel.com \
--cc=rostedt@goodmis.org \
--cc=srinivas.pandruvada@linux.intel.com \
--cc=tim.c.chen@intel.com \
--cc=tim.c.chen@linux.intel.com \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
--cc=x86@kernel.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®