From: riel@redhat.com
To: linux-kernel@vger.kernel.org
Cc: mingo@kernel.org, peterz@infradead.org, mgorman@suse.de,
chegu_vinod@hp.com
Subject: [PATCH 1/4] numa,x86: store maximum numa node distance
Date: Thu, 8 May 2014 13:23:28 -0400 [thread overview]
Message-ID: <1399569811-14362-2-git-send-email-riel@redhat.com> (raw)
In-Reply-To: <1399569811-14362-1-git-send-email-riel@redhat.com>
From: Rik van Riel <riel@redhat.com>
Store the maximum node distance, so the numa placement code can do
better placement on systems with complex numa topology.
The function max_node_distance will return LOCAL_DISTANCE if the
system has simple NUMA topology, with only a single level of
remote distance.
Signed-off-by: Rik van Riel <riel@redhat.com>
Tested-by: Chegu Vinod <chegu_vinod@hp.com>
---
arch/x86/include/asm/topology.h | 3 +++
arch/x86/mm/numa.c | 25 +++++++++++++++++++++++++
include/linux/topology.h | 3 +++
3 files changed, 31 insertions(+)
diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h
index 0e8f04f..3ed2464 100644
--- a/arch/x86/include/asm/topology.h
+++ b/arch/x86/include/asm/topology.h
@@ -95,6 +95,9 @@ extern void setup_node_to_cpumask_map(void);
extern int __node_distance(int, int);
#define node_distance(a, b) __node_distance(a, b)
+extern int max_node_distance(void);
+#define max_node_distance max_node_distance
+
#else /* !CONFIG_NUMA */
static inline int numa_node_id(void)
diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c
index 1d045f9..525cde9 100644
--- a/arch/x86/mm/numa.c
+++ b/arch/x86/mm/numa.c
@@ -34,6 +34,8 @@ __initdata
static int numa_distance_cnt;
static u8 *numa_distance;
+static int numa_max_distance;
+static bool numa_complex_topology;
static __init int numa_setup(char *opt)
{
@@ -357,6 +359,19 @@ void __init numa_reset_distance(void)
memblock_free(__pa(numa_distance), size);
numa_distance_cnt = 0;
numa_distance = NULL; /* enable table creation */
+ numa_max_distance = LOCAL_DISTANCE;
+ numa_complex_topology = false;
+}
+
+static void __init numa_set_max_distance(int distance)
+{
+ /* Remember the maximum node distance seen. */
+ if (distance > numa_max_distance)
+ numa_max_distance = distance;
+
+ /* Do we see any values in-between local distance and the maximum? */
+ if (distance != LOCAL_DISTANCE && distance != numa_max_distance)
+ numa_complex_topology = true;
}
static int __init numa_alloc_distance(void)
@@ -437,6 +452,16 @@ void __init numa_set_distance(int from, int to, int distance)
}
numa_distance[from * numa_distance_cnt + to] = distance;
+
+ numa_set_max_distance(distance);
+}
+
+int max_node_distance(void)
+{
+ if (!numa_complex_topology)
+ return LOCAL_DISTANCE;
+
+ return numa_max_distance;
}
int __node_distance(int from, int to)
diff --git a/include/linux/topology.h b/include/linux/topology.h
index 7062330..6781b8d 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -54,6 +54,9 @@ int arch_update_cpu_topology(void);
#ifndef node_distance
#define node_distance(from,to) ((from) == (to) ? LOCAL_DISTANCE : REMOTE_DISTANCE)
#endif
+#ifndef max_node_distance
+#define max_node_distance() (LOCAL_DISTANCE)
+#endif
#ifndef RECLAIM_DISTANCE
/*
* If the distance between nodes in a system is larger than RECLAIM_DISTANCE
--
1.8.5.3
next prev parent reply other threads:[~2014-05-08 17:23 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-08 17:23 [PATCH 0/4] sched,numa: task placement for complex NUMA topologies riel
2014-05-08 17:23 ` riel [this message]
2014-05-09 9:45 ` [PATCH 1/4] numa,x86: store maximum numa node distance Peter Zijlstra
2014-05-09 15:08 ` Rik van Riel
2014-05-08 17:23 ` [PATCH 2/4] sched,numa: weigh nearby nodes for task placement on complex NUMA topologies riel
2014-05-09 9:53 ` Peter Zijlstra
2014-05-09 15:14 ` Rik van Riel
2014-05-09 9:54 ` Peter Zijlstra
2014-05-09 10:03 ` Peter Zijlstra
2014-05-09 15:16 ` Rik van Riel
2014-05-09 10:11 ` Peter Zijlstra
2014-05-09 15:11 ` Rik van Riel
2014-05-09 10:13 ` Peter Zijlstra
2014-05-09 15:03 ` Rik van Riel
2014-05-08 17:23 ` [PATCH 3/4] sched,numa: store numa_group's preferred nid riel
2014-05-08 17:23 ` [PATCH 4/4] sched,numa: pull workloads towards their preferred nodes riel
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=1399569811-14362-2-git-send-email-riel@redhat.com \
--to=riel@redhat.com \
--cc=chegu_vinod@hp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@kernel.org \
--cc=peterz@infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.