From: Vincent Guittot <vincent.guittot@linaro.org>
To: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
Cc: Juri Lelli <juri.lelli@redhat.com>,
Aubrey Li <aubrey.li@linux.intel.com>,
Srikar Dronamraju <srikar@linux.vnet.ibm.com>,
"Ravi V. Shankar" <ravi.v.shankar@intel.com>,
"Peter Zijlstra \(Intel\)" <peterz@infradead.org>,
Ricardo Neri <ricardo.neri@intel.com>,
Ben Segall <bsegall@google.com>,
Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
"Joel Fernandes \(Google\)" <joel@joelfernandes.org>,
Ingo Molnar <mingo@kernel.org>,
"Rafael J . Wysocki" <rafael.j.wysocki@intel.com>,
Steven Rostedt <rostedt@goodmis.org>,
Mel Gorman <mgorman@suse.de>, Len Brown <len.brown@intel.com>,
Nicholas Piggin <npiggin@gmail.com>,
Aubrey Li <aubrey.li@intel.com>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Tim Chen <tim.c.chen@linux.intel.com>,
Quentin Perret <qperret@google.com>,
Daniel Bristot de Oliveira <bristot@redhat.com>,
linux-kernel <linux-kernel@vger.kernel.org>,
linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH v5 2/6] sched/topology: Introduce sched_group::flags
Date: Fri, 17 Sep 2021 17:26:01 +0200 [thread overview]
Message-ID: <CAKfTPtDHJxtczRCATGJfuHHuQy9NbpXZAsPL1R9Qf=Jd46TU-A@mail.gmail.com> (raw)
In-Reply-To: <20210911011819.12184-3-ricardo.neri-calderon@linux.intel.com>
On Sat, 11 Sept 2021 at 03:19, Ricardo Neri
<ricardo.neri-calderon@linux.intel.com> wrote:
>
> There exist situations in which the load balance needs to know the
> properties of the CPUs in a scheduling group. When using asymmetric
> packing, for instance, the load balancer needs to know not only the
> state of dst_cpu but also of its SMT siblings, if any.
>
> Use the flags of the child scheduling domains to initialize scheduling
> group flags. This will reflect the properties of the CPUs in the
> group.
>
> A subsequent changeset will make use of these new flags. No functional
> changes are introduced.
>
> Cc: Aubrey Li <aubrey.li@intel.com>
> Cc: Ben Segall <bsegall@google.com>
> Cc: Daniel Bristot de Oliveira <bristot@redhat.com>
> Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>
> Cc: Mel Gorman <mgorman@suse.de>
> Cc: Quentin Perret <qperret@google.com>
> 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 Chen <tim.c.chen@linux.intel.com>
> Reviewed-by: Joel Fernandes (Google) <joel@joelfernandes.org>
> Reviewed-by: Len Brown <len.brown@intel.com>
> Originally-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
> ---
> Changes since v4:
> * None
>
> Changes since v3:
> * Clear the flags of the scheduling groups of a domain if its child is
> destroyed.
> * Minor rewording of the commit message.
>
> Changes since v2:
> * Introduced this patch.
>
> Changes since v1:
> * N/A
> ---
> kernel/sched/sched.h | 1 +
> kernel/sched/topology.c | 21 ++++++++++++++++++---
> 2 files changed, 19 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
> index 3d3e5793e117..86ab33ce529d 100644
> --- a/kernel/sched/sched.h
> +++ b/kernel/sched/sched.h
> @@ -1809,6 +1809,7 @@ struct sched_group {
> unsigned int group_weight;
> struct sched_group_capacity *sgc;
> int asym_prefer_cpu; /* CPU of highest priority in group */
> + int flags;
>
> /*
> * The CPUs this group covers.
> diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
> index 4e8698e62f07..c56faae461d9 100644
> --- a/kernel/sched/topology.c
> +++ b/kernel/sched/topology.c
> @@ -716,8 +716,20 @@ cpu_attach_domain(struct sched_domain *sd, struct root_domain *rd, int cpu)
> tmp = sd;
> sd = sd->parent;
> destroy_sched_domain(tmp);
> - if (sd)
> + if (sd) {
> + struct sched_group *sg = sd->groups;
> +
> + /*
> + * sched groups hold the flags of the child sched
> + * domain for convenience. Clear such flags since
> + * the child is being destroyed.
> + */
> + do {
> + sg->flags = 0;
> + } while (sg != sd->groups);
> +
> sd->child = NULL;
> + }
> }
>
> for (tmp = sd; tmp; tmp = tmp->parent)
> @@ -916,10 +928,12 @@ build_group_from_child_sched_domain(struct sched_domain *sd, int cpu)
> return NULL;
>
> sg_span = sched_group_span(sg);
> - if (sd->child)
> + if (sd->child) {
> cpumask_copy(sg_span, sched_domain_span(sd->child));
> - else
> + sg->flags = sd->child->flags;
> + } else {
> cpumask_copy(sg_span, sched_domain_span(sd));
> + }
>
> atomic_inc(&sg->ref);
> return sg;
> @@ -1169,6 +1183,7 @@ static struct sched_group *get_group(int cpu, struct sd_data *sdd)
> if (child) {
> cpumask_copy(sched_group_span(sg), sched_domain_span(child));
> cpumask_copy(group_balance_mask(sg), sched_group_span(sg));
> + sg->flags = child->flags;
> } else {
> cpumask_set_cpu(cpu, sched_group_span(sg));
> cpumask_set_cpu(cpu, group_balance_mask(sg));
> --
> 2.17.1
>
next prev parent reply other threads:[~2021-09-17 15:26 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-11 1:18 [PATCH v5 0/6] sched/fair: Fix load balancing of SMT siblings with ASYM_PACKING Ricardo Neri
2021-09-11 1:18 ` [PATCH v5 1/6] x86/sched: Decrease further the priorities of SMT siblings Ricardo Neri
2021-09-11 1:18 ` [PATCH v5 2/6] sched/topology: Introduce sched_group::flags Ricardo Neri
2021-09-17 15:26 ` Vincent Guittot [this message]
2021-09-11 1:18 ` [PATCH v5 3/6] sched/fair: Optimize checking for group_asym_packing Ricardo Neri
2021-09-17 15:26 ` Vincent Guittot
2021-09-11 1:18 ` [PATCH v5 4/6] sched/fair: Provide update_sg_lb_stats() with sched domain statistics Ricardo Neri
2021-09-17 15:27 ` Vincent Guittot
2021-09-11 1:18 ` [PATCH v5 5/6] sched/fair: Carve out logic to mark a group for asymmetric packing Ricardo Neri
2021-09-17 15:27 ` Vincent Guittot
2021-09-11 1:18 ` [PATCH v5 6/6] sched/fair: Consider SMT in ASYM_PACKING load balance Ricardo Neri
2021-09-15 15:43 ` Vincent Guittot
2021-09-17 1:00 ` Ricardo Neri
2021-09-17 7:41 ` Vincent Guittot
2021-09-17 15:25 ` Vincent Guittot
2021-09-17 18:46 ` Peter Zijlstra
2021-09-18 9:33 ` Vincent Guittot
2021-10-01 9:33 ` Guillaume Tucker
2021-10-01 9:40 ` Guillaume Tucker
2021-10-01 10:25 ` Vincent Guittot
2021-10-01 17:43 ` 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='CAKfTPtDHJxtczRCATGJfuHHuQy9NbpXZAsPL1R9Qf=Jd46TU-A@mail.gmail.com' \
--to=vincent.guittot@linaro.org \
--cc=aubrey.li@intel.com \
--cc=aubrey.li@linux.intel.com \
--cc=bristot@redhat.com \
--cc=bsegall@google.com \
--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=linuxppc-dev@lists.ozlabs.org \
--cc=mgorman@suse.de \
--cc=mingo@kernel.org \
--cc=npiggin@gmail.com \
--cc=peterz@infradead.org \
--cc=qperret@google.com \
--cc=rafael.j.wysocki@intel.com \
--cc=ravi.v.shankar@intel.com \
--cc=ricardo.neri-calderon@linux.intel.com \
--cc=ricardo.neri@intel.com \
--cc=rostedt@goodmis.org \
--cc=srikar@linux.vnet.ibm.com \
--cc=srinivas.pandruvada@linux.intel.com \
--cc=tim.c.chen@linux.intel.com \
/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).