[4/4] [RFC] ppc64 abstract discontig

Andy Whitcroft apw at shadowen.org
Fri May 20 02:47:23 EST 2005


Make initialisation of numa_memory_lookup_table conditional on the
memory model.  Pull out populating the numa_memory_lookup_table
into the memory_present interface.  This effectivly splits out
abstracts and splits DISCONTIGMEM from the other memory models.

Signed-off-by: Andy Whitcroft <apw at shadowen.org>

diffstat ppc64-abstract-discontig
---

diff -upN reference/arch/ppc64/Kconfig current/arch/ppc64/Kconfig
--- reference/arch/ppc64/Kconfig
+++ current/arch/ppc64/Kconfig
@@ -243,6 +243,10 @@ config HAVE_ARCH_EARLY_PFN_TO_NID
 	def_bool y
 	depends on NEED_MULTIPLE_NODES
 
+config ARCH_HAVE_MEMORY_PRESENT
+	def_bool y
+	depends on DISCONTIGMEM
+
 # Some NUMA nodes have memory ranges that span
 # other nodes.  Even though a pfn is valid and
 # between a node's start and end pfns, it may not
diff -upN reference/arch/ppc64/mm/numa.c current/arch/ppc64/mm/numa.c
--- reference/arch/ppc64/mm/numa.c
+++ current/arch/ppc64/mm/numa.c
@@ -34,7 +34,6 @@ static int numa_debug;
 
 int numa_cpu_lookup_table[NR_CPUS] = { [ 0 ... (NR_CPUS - 1)] =
 	ARRAY_INITIALISER};
-char *numa_memory_lookup_table;
 cpumask_t numa_cpumask_lookup_table[MAX_NUMNODES];
 int nr_cpus_in_node[MAX_NUMNODES] = { [0 ... (MAX_NUMNODES -1)] = 0};
 
@@ -52,14 +51,31 @@ static struct {
 	unsigned long node_present_pages;
 } init_node_data[MAX_NUMNODES] __initdata;
 
+#ifdef CONFIG_DISCONTIGMEM
+char *numa_memory_lookup_table;
+
+void memory_present(int nid, unsigned long start, unsigned long end)
+{
+	unsigned long i;
+
+	/* XXX/APW: fix the loop instead ... */
+	start <<= PAGE_SHIFT;
+	end <<= PAGE_SHIFT;
+
+	for (i = start ; i < end; i += MEMORY_INCREMENT)
+		numa_memory_lookup_table[i >> MEMORY_INCREMENT_SHIFT] = nid;
+}
+EXPORT_SYMBOL(numa_memory_lookup_table);
+#endif
+
 EXPORT_SYMBOL(node_data);
 EXPORT_SYMBOL(numa_cpu_lookup_table);
-EXPORT_SYMBOL(numa_memory_lookup_table);
 EXPORT_SYMBOL(numa_cpumask_lookup_table);
 EXPORT_SYMBOL(nr_cpus_in_node);
 
 static inline void discontig_init(unsigned long top)
 {
+#ifdef CONFIG_DISCONTIGMEM
 	unsigned long entries = top >> MEMORY_INCREMENT_SHIFT;
 	unsigned long i;
 
@@ -70,6 +86,7 @@ static inline void discontig_init(unsign
 		for (i = 0; i < entries ; i++)
 			numa_memory_lookup_table[i] = ARRAY_INITIALISER;
 	}
+#endif
 }
 
 static inline void map_cpu_to_node(int cpu, int node)
@@ -445,9 +462,6 @@ new_range:
 				size / PAGE_SIZE;
 		}
 
-		for (i = start ; i < (start+size); i += MEMORY_INCREMENT)
-			numa_memory_lookup_table[i >> MEMORY_INCREMENT_SHIFT] =
-				numa_domain;
 		memory_present(numa_domain, start >> PAGE_SHIFT,
 						(start + size) >> PAGE_SHIFT);
 
@@ -481,8 +495,6 @@ static void __init setup_nonnuma(void)
 	init_node_data[0].node_end_pfn = lmb_end_of_DRAM() / PAGE_SIZE;
 	init_node_data[0].node_present_pages = total_ram / PAGE_SIZE;
 
-	for (i = 0 ; i < top_of_ram; i += MEMORY_INCREMENT)
-		numa_memory_lookup_table[i >> MEMORY_INCREMENT_SHIFT] = 0;
 	memory_present(0, 0, init_node_data[0].node_end_pfn);
 }
 
@@ -499,6 +511,7 @@ static void __init dump_numa_topology(vo
 
 		printk(KERN_INFO "Node %d Memory:", node);
 
+#if 0
 		count = 0;
 
 		for (i = 0; i < lmb_end_of_DRAM(); i += MEMORY_INCREMENT) {
@@ -515,6 +528,7 @@ static void __init dump_numa_topology(vo
 
 		if (count > 0)
 			printk("-0x%lx", i);
+#endif
 		printk("\n");
 	}
 	return;
diff -upN reference/include/asm-ppc64/mmzone.h current/include/asm-ppc64/mmzone.h
--- reference/include/asm-ppc64/mmzone.h
+++ current/include/asm-ppc64/mmzone.h
@@ -30,7 +30,9 @@ extern struct pglist_data *node_data[];
  */
 
 extern int numa_cpu_lookup_table[];
+#ifdef CONFIG_DISCONTIGMEM
 extern char *numa_memory_lookup_table;
+#endif
 extern cpumask_t numa_cpumask_lookup_table[];
 extern int nr_cpus_in_node[];
 
@@ -62,8 +64,8 @@ static inline int pfn_to_nid(unsigned lo
 {
 	int nid;
 
-	nid = numa_memory_lookup_table[pfn >>
-					(MEMORY_INCREMENT_SHIFT - PAGE_SHIFT)];
+	nid = numa_memory_lookup_table[pfn >> (MEMORY_INCREMENT_SHIFT -
+								PAGE_SHIFT)];
 
 #ifdef DEBUG_NUMA
 	/* the physical page passed in is not in the map for the system */



More information about the Linuxppc64-dev mailing list