|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v3 02/22] xen/common: Default function to get the distance between nodes
Provide a fallback function to get the distance between NUMA nodes.
Signed-off-by: Hirokazu Takahashi <taka@xxxxxxxxxxxxx>
---
xen/common/Makefile | 1 +
xen/common/numa-distance-map.c | 19 +++++++++++++++++++
xen/include/xen/numa.h | 2 ++
3 files changed, 22 insertions(+)
create mode 100644 xen/common/numa-distance-map.c
diff --git a/xen/common/Makefile b/xen/common/Makefile
index 6018e25614..062f9ab72b 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -32,6 +32,7 @@ obj-$(CONFIG_VM_EVENT) += monitor.o
obj-y += multicall.o
obj-y += notifier.o
obj-$(CONFIG_NUMA) += numa.o
+obj-$(CONFIG_NUMA_DISTANCE_MAP) += numa-distance-map.o
obj-y += page_alloc.o
obj-y += pdx.o
obj-y += percpu.o
diff --git a/xen/common/numa-distance-map.c b/xen/common/numa-distance-map.c
new file mode 100644
index 0000000000..73344f7f33
--- /dev/null
+++ b/xen/common/numa-distance-map.c
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include <xen/errno.h>
+#include <xen/init.h>
+#include <xen/nodemask.h>
+#include <xen/numa.h>
+
+#define LOCAL_DISTANCE 10
+#define REMOTE_DISTANCE 20
+
+/*
+ * Get the distance between node 'from' and node 'to'.
+ */
+uint8_t numa_node_distance(unsigned int from, unsigned int to)
+{
+ if ( from != to )
+ return REMOTE_DISTANCE;
+ return LOCAL_DISTANCE;
+}
diff --git a/xen/include/xen/numa.h b/xen/include/xen/numa.h
index f6c1f27ca1..18c22d3d30 100644
--- a/xen/include/xen/numa.h
+++ b/xen/include/xen/numa.h
@@ -128,6 +128,8 @@ extern bool numa_update_node_memblks(nodeid_t node,
unsigned int arch_nid,
paddr_t start, paddr_t size, bool
hotplug);
extern void numa_set_processor_nodes_parsed(nodeid_t node);
+extern uint8_t numa_node_distance(unsigned int from, unsigned int to);
+
#else
/* Fake one node for now. See also node_online_map. */
--
2.43.0
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |