From: Peter Zijlstra <peterz@infradead.org>
To: David Rientjes <rientjes@google.com>
Cc: Ingo Molnar <mingo@kernel.org>,
hpa@zytor.com, linux-kernel@vger.kernel.org,
torvalds@linux-foundation.org, pjt@google.com, cl@linux.com,
riel@redhat.com, bharata.rao@gmail.com,
akpm@linux-foundation.org, Lee.Schermerhorn@hp.com,
aarcange@redhat.com, danms@us.ibm.com, suresh.b.siddha@intel.com,
tglx@linutronix.de, linux-tip-commits@vger.kernel.org
Subject: Re: [tip:sched/numa] sched/numa: Introduce sys_numa_{t,m}bind()
Date: Wed, 23 May 2012 18:00:43 +0200 [thread overview]
Message-ID: <1337788843.9783.14.camel@laptop> (raw)
In-Reply-To: <1337698830.9698.37.camel@twins>
On Tue, 2012-05-22 at 17:00 +0200, Peter Zijlstra wrote:
> /me goes kick his gray cells some more.
OK, does the below make your machine happy? If not, please share the
completely topology setup of that thing (lscpu or similar).
---
Subject: sched: Fix SD_OVERLAP
SD_OVERLAP exists to allow overlapping groups, overlapping groups
appear in NUMA topologies that aren't fully connected.
The typical result of not fully connected NUMA is that each cpu (or
rather node) will have different spans for a particular distance.
However due to how sched domains are traversed -- only the first cpu
in the mask goes one level up -- the next level only cares about the
spans of the cpus that went up.
Due to this two things were observed to be broken:
- build_overlap_sched_groups() -- since its possible the cpu we're
building the groups for exists in multiple (or all) groups, the
selection criteria of the first group didn't ensure there was a cpu
for which is was true that cpumask_first(span) == cpu. Thus load-
balancing would terminate.
- update_group_power() -- assumed that the cpu span of the first
group of the domain was covered by all groups of the child domain.
The above explains why this isn't true, so deal with it.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
kernel/sched/core.c | 7 +++++--
kernel/sched/fair.c | 25 ++++++++++++++++++++-----
2 files changed, 25 insertions(+), 7 deletions(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 18eed17..29217a4 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -6007,11 +6007,14 @@ build_overlap_sched_groups(struct sched_domain *sd, int cpu)
cpumask_or(covered, covered, sg_span);
- sg->sgp = *per_cpu_ptr(sdd->sgp, cpumask_first(sg_span));
+ sg->sgp = *per_cpu_ptr(sdd->sgp, i);
atomic_inc(&sg->sgp->ref);
- if (cpumask_test_cpu(cpu, sg_span))
+ if ((!groups && cpumask_test_cpu(cpu, sg_span)) ||
+ cpumask_first(sg_span) == cpu) {
+ WARN_ON_ONCE(!cpumask_test_cpu(cpu, sg_span));
groups = sg;
+ }
if (!first)
first = sg;
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index de49ed5..7466b7a 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -3768,11 +3768,26 @@ void update_group_power(struct sched_domain *sd, int cpu)
power = 0;
- group = child->groups;
- do {
- power += group->sgp->power;
- group = group->next;
- } while (group != child->groups);
+ if (child->flags & SD_OVERLAP) {
+ /*
+ * SD_OVERLAP domains cannot assume that child groups
+ * span the current group.
+ */
+
+ for_each_cpu(cpu, sched_group_cpus(sdg))
+ power += power_of(cpu);
+ } else {
+ /*
+ * !SD_OVERLAP domains can assume that child groups
+ * span the current group.
+ */
+
+ group = child->groups;
+ do {
+ power += group->sgp->power;
+ group = group->next;
+ } while (group != child->groups);
+ }
sdg->sgp->power = power;
}
next prev parent reply other threads:[~2012-05-23 16:00 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-18 10:42 [tip:sched/numa] sched/numa: Introduce sys_numa_{t,m}bind() tip-bot for Peter Zijlstra
2012-05-18 15:14 ` Rik van Riel
2012-05-18 15:25 ` Christoph Lameter
2012-05-18 15:33 ` Peter Zijlstra
2012-05-18 15:37 ` Christoph Lameter
2012-05-18 15:47 ` Peter Zijlstra
2012-05-18 15:35 ` Peter Zijlstra
2012-05-18 15:40 ` Peter Zijlstra
2012-05-18 15:47 ` Christoph Lameter
2012-05-18 15:49 ` Peter Zijlstra
2012-05-18 16:00 ` Christoph Lameter
2012-05-18 16:04 ` Peter Zijlstra
2012-05-18 16:07 ` Christoph Lameter
2012-05-18 15:48 ` Rik van Riel
2012-05-18 16:05 ` Peter Zijlstra
2012-05-19 11:19 ` Ingo Molnar
2012-05-19 11:09 ` Ingo Molnar
2012-05-19 10:32 ` Pekka Enberg
2012-05-20 2:23 ` David Rientjes
2012-05-21 8:40 ` Ingo Molnar
2012-05-22 2:16 ` David Rientjes
2012-05-22 2:42 ` David Rientjes
2012-05-22 12:04 ` Peter Zijlstra
2012-05-22 15:00 ` Peter Zijlstra
2012-05-23 16:00 ` Peter Zijlstra [this message]
2012-05-24 0:58 ` David Rientjes
2012-05-25 8:35 ` Peter Zijlstra
2012-05-31 22:03 ` Peter Zijlstra
2012-05-30 13:37 ` [tip:sched/urgent] sched: Fix SD_OVERLAP tip-bot for Peter Zijlstra
2012-05-30 13:38 ` [tip:sched/urgent] sched: Make sure to not re-read variables after validation tip-bot for Peter Zijlstra
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=1337788843.9783.14.camel@laptop \
--to=peterz@infradead.org \
--cc=Lee.Schermerhorn@hp.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=bharata.rao@gmail.com \
--cc=cl@linux.com \
--cc=danms@us.ibm.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=pjt@google.com \
--cc=riel@redhat.com \
--cc=rientjes@google.com \
--cc=suresh.b.siddha@intel.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.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