From: Hillf Danton <dhillf@gmail.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: LKML <linux-kernel@vger.kernel.org>, Ingo Molnar <mingo@elte.hu>,
Mike Galbraith <efault@gmx.de>,
Yong Zhang <yong.zhang0@gmail.com>
Subject: Re: [PATCH] sched: fix constructing the span cpu mask of sched domain
Date: Wed, 11 May 2011 21:26:35 +0800 [thread overview]
Message-ID: <BANLkTin5iNMt2autv3TJpCvTQUoKsSzhTA@mail.gmail.com> (raw)
In-Reply-To: <1305016329.2914.22.camel@laptop>
On Tue, May 10, 2011 at 4:32 PM, Peter Zijlstra <peterz@infradead.org> wrote:
> If you're interested in this area of the scheduler, you might want to
> have a poke at:
>
> http://marc.info/?l=linux-kernel&m=130218515520540
>
> That tries to rewrite the CONFIG_NUMA support for the sched_domain stuff
> to create domains based on the node_distance() to better reflect the
> actual machine topology.
>
> As stated, that patch is currently very broken, mostly because the
> topologies encountered don't map to non-overlapping trees. I've not yet
> come up with how to deal with that, but we sure need to do something
> like that, the current group 16 nodes and a group of all simply doesn't
> work well for today's machines now that NUMA is both common and the
> inter-node latencies are more relevant.
>
Hi Peter
Your work for rewriting NUMA support, published at
http://marc.info/?l=linux-kernel&m=130218515520540
is patched by changing how level is computed and by changing how it is
used to build the mask.
When computing, some valid levels are lost in your work.
When building mask, nodes are selected only if they have same distance,
thus nodes of less distance are also masked out since the computation of
level now is tough.
Without MUNA hardware, I did not test the patch:(
Hillf
---
--- numa_by_peter.c 2011-05-11 20:22:10.000000000 +0800
+++ numa_by_hillf.c 2011-05-11 21:06:26.000000000 +0800
@@ -1,6 +1,5 @@
static void sched_init_numa(void)
{
- int next_distance, curr_distance = node_distance(0, 0);
struct sched_domain_topology_level *tl;
int level = 0;
int i, j, k;
@@ -11,21 +10,34 @@ static void sched_init_numa(void)
if (!sched_domains_numa_distance)
return;
- next_distance = curr_distance;
- for (i = 0; i < nr_node_ids; i++) {
- for (j = 0; j < nr_node_ids; j++) {
- int distance = node_distance(0, j);
- printk("distance(0,%d): %d\n", j, distance);
- if (distance > curr_distance &&
- (distance < next_distance ||
- next_distance == curr_distance))
- next_distance = distance;
+ for (j = 0; j < nr_node_ids; j++) {
+ int distance = node_distance(0, j);
+ printk("distance(0,%d): %d\n", j, distance);
+ if (j == 0) {
+ sched_domains_numa_distance[j] = distance;
+ sched_domains_numa_levels = ++level;
+ continue;
}
- if (next_distance != curr_distance) {
- sched_domains_numa_distance[level++] = next_distance;
+ for (i = 0; i < level; i++) {
+ /* check if already exist */
+ if (distance == sched_domains_numa_distance[i])
+ goto next_node;
+ /* sort and insert it */
+ if (distance < sched_domains_numa_distance[i])
+ break;
+ }
+ if (i == level) {
+ sched_domains_numa_distance[level++] = distance;
sched_domains_numa_levels = level;
- curr_distance = next_distance;
- } else break;
+ continue;
+ }
+ for (k = level -1; k >= i; k--)
+ sched_domains_numa_distance[k+1] =
+ sched_domains_numa_distance[k];
+ sched_domains_numa_distance[i] = distance;
+ sched_domains_numa_levels = ++level;
+next_node:
+ ;
}
sched_domains_numa_masks = kzalloc(sizeof(void *) * level, GFP_KERNEL);
@@ -44,8 +56,9 @@ static void sched_init_numa(void)
struct cpumask *mask =
per_cpu_ptr(sched_domains_numa_masks[i], j);
+ cpumask_clear(mask);
for (k = 0; k < nr_node_ids; k++) {
- if (node_distance(cpu_to_node(j), k) >
+ if (node_distance(cpu_to_node(j), k) !=
sched_domains_numa_distance[i])
continue;
next prev parent reply other threads:[~2011-05-11 16:07 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-05 12:53 [PATCH] sched: fix constructing the span cpu mask of sched domain Hillf Danton
2011-05-06 7:12 ` Ingo Molnar
2011-05-06 7:40 ` [tip:sched/core] sched: Shorten the construction of " tip-bot for Hillf Danton
2011-05-10 8:32 ` [PATCH] sched: fix constructing " Peter Zijlstra
2011-05-10 12:29 ` Hillf Danton
2011-05-11 13:26 ` Hillf Danton [this message]
2011-05-11 13:54 ` Peter Zijlstra
2011-05-11 14:10 ` Hillf Danton
2011-05-11 14:15 ` Ingo Molnar
2011-05-11 14:23 ` Hillf Danton
2011-05-13 13:06 ` Hillf Danton
2011-05-15 5:50 ` Hillf Danton
2011-05-17 9:23 ` Andreas Herrmann
2011-05-17 14:36 ` Hillf Danton
2011-05-18 2:45 ` Yong Zhang
2011-05-18 15:12 ` Hillf Danton
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=BANLkTin5iNMt2autv3TJpCvTQUoKsSzhTA@mail.gmail.com \
--to=dhillf@gmail.com \
--cc=efault@gmx.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
--cc=yong.zhang0@gmail.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).