Skip to contentSkip to conversation

Fix wrong local_cpulist displayed

PATCH-next Jin Dongming 1 participant 1 message Dec 24, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

On my machine(Not NUMA), when the CONFIG_NUMA is selected, the value of local_cpulist is displayed wrong. Because the value of numa_node is -1, so the wrong address will be returned and the wrong value of local_cpulist is displayed.

The example on my machine is as following:
Before my patch

        #cd /sys/device/pci0000:00/0000:00:1c.0
        #cat cpulist
                /* nothing */

After my pache

        #cd /sys/device/pci0000:00/0000:00:1c.0
        #cat cpulist
         0-1

I confirmed this patch fixes the above problem.

---
 arch/x86/include/asm/topology.h |    2 +-
 arch/x86/mm/numa.c              |    3 +++
 2 files changed, 4 insertions(+), 1 deletions(-)
arch/x86/include/asm/topology.h +1 -1
index c5087d7..c63921a 100644
@@ -99,7 +99,7 @@ extern const struct cpumask *cpumask_of_node(int node);
 /* Returns a pointer to the cpumask of CPUs on Node 'node'. */
 static inline const struct cpumask *cpumask_of_node(int node)
 {
-	return node_to_cpumask_map[node];
+	return node == -1 ? cpu_online_mask : node_to_cpumask_map[node];
 }
 #endif
 
arch/x86/mm/numa.c +3 -0
index 550df48..e57a7f5 100644
@@ -47,6 +47,9 @@ void __init setup_node_to_cpumask_map(void)
  */
 const struct cpumask *cpumask_of_node(int node)
 {
+	if (node == -1)
+		return cpu_online_mask;
+
 	if (node >= nr_node_ids) {
 		printk(KERN_WARNING
 			"cpumask_of_node(%d): node > nr_node_ids(%d)\n",
Signature · 1 line
1.6.4