linux-numa.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86: more strict check when cpu hot-plugged
       [not found] <1269409074-30091-1-git-send-email-gong.chen@linux.intel.com>
@ 2010-03-24  5:37 ` Chen Gong
  0 siblings, 0 replies; only message in thread
From: Chen Gong @ 2010-03-24  5:37 UTC (permalink / raw)
  To: haicheng.li, hpa, andi-nbz; +Cc: linux-numa, Chen Gong

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@linux.intel.com>
---
 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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2010-03-24  5:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1269409074-30091-1-git-send-email-gong.chen@linux.intel.com>
2010-03-24  5:37 ` [PATCH] x86: more strict check when cpu hot-plugged Chen Gong

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).