[2/4] [RFC] ppc64 early_pfn_to_nid stop using numa_memory_lookup

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


Split early_pfn_to_nid off of numa_memory_lookup_table.  Use the basic
node configuration to locate node for memory pages.

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

diffstat ppc64-early_pfn_to_nid-stop-using-numa_memory_lookup
---

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
@@ -735,3 +735,19 @@ static int __init early_numa(char *p)
 	return 0;
 }
 early_param("numa", early_numa);
+
+/* Find the owning node for a pfn. */
+int early_pfn_to_nid(unsigned long pfn)
+{
+        int nid;
+
+        for (nid = 0; nid < MAX_NUMNODES &&
+			init_node_data[nid].node_end_pfn; nid++) {
+		unsigned long start = init_node_data[nid].node_start_pfn;
+		unsigned long end = init_node_data[nid].node_end_pfn;
+                if (start <= pfn && pfn <= end)
+                        return nid;
+	}
+
+        return 0;
+}
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
@@ -102,7 +102,7 @@ static inline int pa_to_nid(unsigned lon
 #endif /* CONFIG_NEED_MULTIPLE_NODES */
 
 #ifdef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
-#define early_pfn_to_nid(pfn)  pa_to_nid(((unsigned long)pfn) << PAGE_SHIFT)
+extern int early_pfn_to_nid(unsigned long pfn);
 #endif
 
 #endif /* _ASM_MMZONE_H_ */



More information about the Linuxppc64-dev mailing list