Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1221909
| From | Tang Chen <tangchen@cn.fujitsu.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v2 1/7] x86, numa: Move definition of find_near_online_node() forward. |
| Date | 2015-09-10 06:40 +0200 |
| Message-ID | <q71Op-7Qc-17@gated-at.bofh.it> (permalink) |
| References | <q71EK-7Fd-15@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Will call this function earlier in next coming patches.
So simply move its definition forward. And also, add comments for it.
Signed-off-by: Tang Chen <tangchen@cn.fujitsu.com>
---
arch/x86/mm/numa.c | 47 +++++++++++++++++++++++++++++------------------
1 file changed, 29 insertions(+), 18 deletions(-)
diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c
index 4053bb5..fea387a 100644
--- a/arch/x86/mm/numa.c
+++ b/arch/x86/mm/numa.c
@@ -78,6 +78,35 @@ EXPORT_SYMBOL(node_to_cpumask_map);
DEFINE_EARLY_PER_CPU(int, x86_cpu_to_node_map, NUMA_NO_NODE);
EXPORT_EARLY_PER_CPU_SYMBOL(x86_cpu_to_node_map);
+/**
+ * find_near_online_node - Find the best near online node of a node.
+ * @node: NUMA node ID of the current node.
+ *
+ * Find the best near online node of @node, based on node_distance[] array.
+ * The best near online node is the backup node for memory allocation on
+ * one node.
+ *
+ * RETURNS:
+ * The best near online node ID on success, -1 on failure.
+ */
+static __init int find_near_online_node(int node)
+{
+ int n, val;
+ int min_val = INT_MAX;
+ int near_node = -1;
+
+ for_each_online_node(n) {
+ val = node_distance(node, n);
+
+ if (val < min_val) {
+ min_val = val;
+ near_node = n;
+ }
+ }
+
+ return near_node;
+}
+
void numa_set_node(int cpu, int node)
{
int *cpu_to_node_map = early_per_cpu_ptr(x86_cpu_to_node_map);
@@ -702,24 +731,6 @@ void __init x86_numa_init(void)
numa_init(dummy_numa_init);
}
-static __init int find_near_online_node(int node)
-{
- int n, val;
- int min_val = INT_MAX;
- int best_node = -1;
-
- for_each_online_node(n) {
- val = node_distance(node, n);
-
- if (val < min_val) {
- min_val = val;
- best_node = n;
- }
- }
-
- return best_node;
-}
-
/*
* Setup early cpu_to_node.
*
--
1.9.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v2 0/7] Make cpuid <-> nodeid mapping persistent. Tang Chen <tangchen@cn.fujitsu.com> - 2015-09-10 06:30 +0200
[PATCH v2 6/7] x86, acpi, cpu-hotplug: Enable MADT APIs to return disabled apicid. Tang Chen <tangchen@cn.fujitsu.com> - 2015-09-10 06:40 +0200
[PATCH v2 2/7] x86, numa: Introduce a node to node array to map a node to its best online node. Tang Chen <tangchen@cn.fujitsu.com> - 2015-09-10 06:40 +0200
[PATCH v2 7/7] x86, acpi, cpu-hotplug: Set persistent cpuid <-> nodeid mapping when booting. Tang Chen <tangchen@cn.fujitsu.com> - 2015-09-10 06:40 +0200
[PATCH v2 1/7] x86, numa: Move definition of find_near_online_node() forward. Tang Chen <tangchen@cn.fujitsu.com> - 2015-09-10 06:40 +0200
[PATCH v2 5/7] x86, acpi, cpu-hotplug: Introduce apicid_to_cpuid[] array to store persistent cpuid <-> apicid mapping. Tang Chen <tangchen@cn.fujitsu.com> - 2015-09-10 06:40 +0200
Re: [PATCH v2 5/7] x86, acpi, cpu-hotplug: Introduce apicid_to_cpuid[] array to store persistent cpuid <-> apicid mapping. Tejun Heo <tj@kernel.org> - 2015-09-10 22:00 +0200
[PATCH v2 3/7] x86, gfp: Cache best near node for memory allocation. Tang Chen <tangchen@cn.fujitsu.com> - 2015-09-10 06:40 +0200
Re: [PATCH v2 3/7] x86, gfp: Cache best near node for memory allocation. Tejun Heo <tj@kernel.org> - 2015-09-10 21:30 +0200
Re: [PATCH v2 3/7] x86, gfp: Cache best near node for memory allocation. Tejun Heo <tj@kernel.org> - 2015-09-10 21:40 +0200
Re: [PATCH v2 3/7] x86, gfp: Cache best near node for memory allocation. Christoph Lameter <cl@linux.com> - 2015-09-11 00:10 +0200
Re: [PATCH v2 3/7] x86, gfp: Cache best near node for memory allocation. Tejun Heo <tj@kernel.org> - 2015-09-11 00:10 +0200
Re: [PATCH v2 3/7] x86, gfp: Cache best near node for memory allocation. Christoph Lameter <cl@linux.com> - 2015-09-11 02:20 +0200
[PATCH v2 4/7] x86, acpi, cpu-hotplug: Enable acpi to register all possible cpus at boot time. Tang Chen <tangchen@cn.fujitsu.com> - 2015-09-10 06:40 +0200
Re: [PATCH v2 4/7] x86, acpi, cpu-hotplug: Enable acpi to register all possible cpus at boot time. "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2015-09-11 00:50 +0200
csiph-web