[3/4] [RFC] ppc64 discontig pfn_to_nid direct to numa_memory_lookup
Andy Whitcroft
apw at shadowen.org
Fri May 20 02:46:23 EST 2005
Split off pa_to_nid from the numa_memory_lookup_table. As a result
pfn_to_nid for the DISCONTIGMEM model moved to directly accessing
it.
Signed-off-by: Andy Whitcroft <apw at shadowen.org>
diffstat ppc64-discontig-pfn_to_nid-direct-to-numa_memory_lookup
---
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
@@ -41,22 +41,7 @@ extern int nr_cpus_in_node[];
/* NUMA debugging, will not work on a DLPAR machine */
#undef DEBUG_NUMA
-static inline int pa_to_nid(unsigned long pa)
-{
- int nid;
-
- nid = numa_memory_lookup_table[pa >> MEMORY_INCREMENT_SHIFT];
-
-#ifdef DEBUG_NUMA
- /* the physical address passed in is not in the map for the system */
- if (nid == -1) {
- printk("bad address: %lx\n", pa);
- BUG();
- }
-#endif
-
- return nid;
-}
+#define pa_to_nid(pa) early_pfn_to_nid((pa) >> PAGE_SHIFT)
#define node_localnr(pfn, nid) ((pfn) - NODE_DATA(nid)->node_start_pfn)
@@ -72,12 +57,29 @@ static inline int pa_to_nid(unsigned lon
#ifdef CONFIG_DISCONTIGMEM
+/* Given a page frame number return the owning node. */
+static inline int pfn_to_nid(unsigned long pfn)
+{
+ int nid;
+
+ 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 */
+ if (nid == -1) {
+ printk("bad pfn: %lx\n", pfn);
+ BUG();
+ }
+#endif
+
+ return nid;
+}
+
/*
* Given a kernel address, find the home node of the underlying memory.
*/
-#define kvaddr_to_nid(kaddr) pa_to_nid(__pa(kaddr))
-
-#define pfn_to_nid(pfn) pa_to_nid((unsigned long)(pfn) << PAGE_SHIFT)
+#define kvaddr_to_nid(kaddr) pa_to_nid(__pa(kaddr) >> PAGE_SHIFT)
/* Written this way to avoid evaluating arguments twice */
#define discontigmem_pfn_to_page(pfn) \
More information about the Linuxppc64-dev
mailing list