[PATCH] x86: more strict check when cpu hot-plugged

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When cpu is hot-plugged, it needs to be registered to one
proper node under NUMA enabled mode. The check condition
is very important so the more strict check is necessary.

Signed-off-by: Chen Gong <gong.chen@xxxxxxxxxxxxxxx>
---
 arch/x86/include/asm/numa_64.h |    1 +
 arch/x86/kernel/acpi/boot.c    |    8 +++++++-
 arch/x86/mm/numa_64.c          |    2 +-
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/numa_64.h b/arch/x86/include/asm/numa_64.h
index 823e070..c1ffb7f 100644
--- a/arch/x86/include/asm/numa_64.h
+++ b/arch/x86/include/asm/numa_64.h
@@ -31,6 +31,7 @@ extern void setup_node_bootmem(int nodeid, unsigned long start,
  */
 #define NODE_MIN_SIZE (4*1024*1024)
 
+extern int __cpuinit find_near_online_node(int node);
 extern void __init init_cpu_to_node(void);
 extern void __cpuinit numa_set_node(int cpu, int node);
 extern void __cpuinit numa_clear_node(int cpu);
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 0061ea2..6f911aa 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -498,12 +498,18 @@ static void acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
 	int nid;
 
 	nid = acpi_get_node(handle);
-	if (nid == -1 || !node_online(nid))
+	if (nid == NUMA_NO_NODE || physid == BAD_APICID)
 		return;
 #ifdef CONFIG_X86_64
+	if (!node_online(nid))
+		nid = find_near_online_node(nid);
+
 	apicid_to_node[physid] = nid;
 	numa_set_node(cpu, nid);
 #else /* CONFIG_X86_32 */
+	if (!node_online(nid))
+		return;
+
 	apicid_2_node[physid] = nid;
 	cpu_to_node_map[cpu] = nid;
 #endif
diff --git a/arch/x86/mm/numa_64.c b/arch/x86/mm/numa_64.c
index 8948f47..898027b 100644
--- a/arch/x86/mm/numa_64.c
+++ b/arch/x86/mm/numa_64.c
@@ -733,7 +733,7 @@ early_param("numa", numa_setup);
 
 #ifdef CONFIG_NUMA
 
-static __init int find_near_online_node(int node)
+int __cpuinit find_near_online_node(int node)
 {
 	int n, val;
 	int min_val = INT_MAX;
-- 
1.7.0.2.279.gf1ba1c

--
To unsubscribe from this list: send the line "unsubscribe linux-numa" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]     [Devices]

  Powered by Linux