From: Peter Zijlstra <peterz@infradead.org>
To: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
Cc: Ingo Molnar <mingo@kernel.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.comi>, Mel Gorman <mgorman@suse.de>,
Len Brown <len.brown@intel.com>,
Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
Tim Chen <tim.c.chen@linux.intel.com>,
Aubrey Li <aubrey.li@linux.intel.com>,
"Ravi V. Shankar" <ravi.v.shankar@intel.com>,
Ricardo Neri <ricardo.neri@intel.com>,
Quentin Perret <qperret@google.com>,
"Joel Fernandes (Google)" <joel@joelfernandes.org>,
linux-kernel@vger.kernel.org, Aubrey Li <aubrey.li@intel.com>,
Ben Segall <bsegall@google.com>,
Daniel Bristot de Oliveira <bristot@redhat.com>
Subject: Re: [PATCH v2 3/4] sched/fair: Consider SMT in ASYM_PACKING load balance
Date: Mon, 3 May 2021 12:23:36 +0200 [thread overview]
Message-ID: <YI/PKAkjLeaKEXrn@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <YI/KSfWuGLhPnilr@hirez.programming.kicks-ass.net>
On Mon, May 03, 2021 at 12:02:49PM +0200, Peter Zijlstra wrote:
> On Tue, Apr 13, 2021 at 07:04:35PM -0700, Ricardo Neri wrote:
> > @@ -8507,6 +8616,18 @@ static bool update_sd_pick_busiest(struct lb_env *env,
> > if (!sgs->sum_h_nr_running)
> > return false;
> >
> > + /*
> > + * @sg may have been tentatively classified as group_asym_packing.
> > + * Now that we have sufficient information about @sds.local, reassess
> > + * if asym packing migration can be done. Reclassify @sg. The only
> > + * possible results are group_has_spare and group_fully_busy.
> > + */
> > + if (sgs->group_type == group_asym_packing &&
> > + !asym_can_pull_tasks(env->dst_cpu, sds, sgs, sg)) {
> > + sgs->group_asym_packing = 0;
> > + sgs->group_type = group_classify(env->sd->imbalance_pct, sg, sgs);
> > + }
>
> So if this really is all about not having sds.local in
> update_sd_lb_stats(), then that seems fixable. Let me haz a try.
How's this then?
---
kernel/sched/fair.c | 25 ++++++++++++++++++++-----
1 file changed, 20 insertions(+), 5 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 3bdc41f22909..e9dcbee5b3d9 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -8437,6 +8437,21 @@ group_type group_classify(unsigned int imbalance_pct,
return group_has_spare;
}
+static inline bool
+sched_asym(struct lb_env *env, struct sd_lb_stats *sds, struct sched_group *group)
+{
+ /*
+ * Because sd->groups starts with the local group, anything that isn't
+ * the local group will have access to the local state.
+ */
+ if (group == sds->local)
+ return false;
+
+ /* XXX do magic here */
+
+ return sched_asym_prefer(env->dst_cpu, group->asym_prefer_cpu);
+}
+
/**
* update_sg_lb_stats - Update sched_group's statistics for load balancing.
* @env: The load balancing environment.
@@ -8445,6 +8460,7 @@ group_type group_classify(unsigned int imbalance_pct,
* @sg_status: Holds flag indicating the status of the sched_group
*/
static inline void update_sg_lb_stats(struct lb_env *env,
+ struct sd_lb_stats *sds,
struct sched_group *group,
struct sg_lb_stats *sgs,
int *sg_status)
@@ -8453,7 +8469,7 @@ static inline void update_sg_lb_stats(struct lb_env *env,
memset(sgs, 0, sizeof(*sgs));
- local_group = cpumask_test_cpu(env->dst_cpu, sched_group_span(group));
+ local_group = group == sds->local;
for_each_cpu_and(i, sched_group_span(group), env->cpus) {
struct rq *rq = cpu_rq(i);
@@ -8498,9 +8514,8 @@ static inline void update_sg_lb_stats(struct lb_env *env,
/* Check if dst CPU is idle and preferred to this group */
if (env->sd->flags & SD_ASYM_PACKING &&
- env->idle != CPU_NOT_IDLE &&
- sgs->sum_h_nr_running &&
- sched_asym_prefer(env->dst_cpu, group->asym_prefer_cpu)) {
+ env->idle != CPU_NOT_IDLE && sgs->sum_h_nr_running &&
+ sched_asym(env, sds, group)) {
sgs->group_asym_packing = 1;
}
@@ -9016,7 +9031,7 @@ static inline void update_sd_lb_stats(struct lb_env *env, struct sd_lb_stats *sd
update_group_capacity(env->sd, env->dst_cpu);
}
- update_sg_lb_stats(env, sg, sgs, &sg_status);
+ update_sg_lb_stats(env, sds, sg, sgs, &sg_status);
if (local_group)
goto next_group;
next prev parent reply other threads:[~2021-05-03 10:24 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-14 2:04 [PATCH v2 0/4] sched/fair: Fix load balancing of SMT siblings with ASYM_PACKING Ricardo Neri
2021-04-14 2:04 ` [PATCH v2 1/4] sched/fair: Optimize checking for group_asym_packing Ricardo Neri
2021-05-03 9:24 ` Peter Zijlstra
2021-05-04 3:08 ` Ricardo Neri
2021-04-14 2:04 ` [PATCH v2 2/4] sched/fair: Introduce arch_sched_asym_prefer_early() Ricardo Neri
2021-04-14 2:04 ` [PATCH v2 3/4] sched/fair: Consider SMT in ASYM_PACKING load balance Ricardo Neri
2021-05-03 9:52 ` Peter Zijlstra
2021-05-06 4:28 ` Ricardo Neri
2021-05-06 9:17 ` Peter Zijlstra
2021-05-03 9:54 ` Peter Zijlstra
2021-05-03 10:02 ` Peter Zijlstra
2021-05-03 10:23 ` Peter Zijlstra [this message]
2021-05-04 3:09 ` Ricardo Neri
2021-05-06 4:26 ` Ricardo Neri
2021-05-06 9:18 ` Peter Zijlstra
2021-04-14 2:04 ` [PATCH v2 4/4] x86/sched: Enable checks of the state of SMT siblings in load balancing Ricardo Neri
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=YI/PKAkjLeaKEXrn@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=aubrey.li@intel.com \
--cc=aubrey.li@linux.intel.com \
--cc=bristot@redhat.com \
--cc=bsegall@google.com \
--cc=bsegall@google.comi \
--cc=dietmar.eggemann@arm.com \
--cc=joel@joelfernandes.org \
--cc=juri.lelli@redhat.com \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@kernel.org \
--cc=qperret@google.com \
--cc=ravi.v.shankar@intel.com \
--cc=ricardo.neri-calderon@linux.intel.com \
--cc=ricardo.neri@intel.com \
--cc=rostedt@goodmis.org \
--cc=srinivas.pandruvada@linux.intel.com \
--cc=tim.c.chen@linux.intel.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).