[PATCH 1/3]: Remove kvaddr_to_nid and local_mapnr
Anton Blanchard
anton at samba.org
Thu Sep 29 17:26:16 EST 2005
local_mapnr wasnt used anywhere and kvaddr_to_nid was used in one spot.
Signed-off-by: Anton Blanchard <anton at samba.org>
---
Index: build/arch/alpha/mm/numa.c
===================================================================
--- build.orig/arch/alpha/mm/numa.c 2005-09-13 12:48:54.000000000 +1000
+++ build/arch/alpha/mm/numa.c 2005-09-13 12:49:25.000000000 +1000
@@ -279,7 +279,7 @@
initrd_end,
phys_to_virt(PFN_PHYS(max_low_pfn)));
} else {
- nid = kvaddr_to_nid(initrd_start);
+ nid = pa_to_nid(__pa(initrd_start));
reserve_bootmem_node(NODE_DATA(nid),
virt_to_phys((void *)initrd_start),
INITRD_SIZE);
Index: build/include/asm-alpha/mmzone.h
===================================================================
--- build.orig/include/asm-alpha/mmzone.h 2005-09-13 12:48:54.000000000 +1000
+++ build/include/asm-alpha/mmzone.h 2005-09-13 12:49:25.000000000 +1000
@@ -32,8 +32,6 @@
#define pa_to_nid(pa) alpha_pa_to_nid(pa)
#define NODE_DATA(nid) (&node_data[(nid)])
-#define node_localnr(pfn, nid) ((pfn) - NODE_DATA(nid)->node_start_pfn)
-
#if 1
#define PLAT_NODE_DATA_LOCALNR(p, n) \
(((p) >> PAGE_SHIFT) - PLAT_NODE_DATA(n)->gendata.node_start_pfn)
@@ -49,28 +47,14 @@
#ifdef CONFIG_DISCONTIGMEM
+#define node_localnr(pfn, nid) ((pfn) - NODE_DATA(nid)->node_start_pfn)
+
/*
* Following are macros that each numa implementation must define.
*/
-/*
- * Given a kernel address, find the home node of the underlying memory.
- */
-#define kvaddr_to_nid(kaddr) pa_to_nid(__pa(kaddr))
#define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn)
-#define local_mapnr(kvaddr) \
- ((__pa(kvaddr) >> PAGE_SHIFT) - node_start_pfn(kvaddr_to_nid(kvaddr)))
-
-/*
- * Given a kaddr, LOCAL_BASE_ADDR finds the owning node of the memory
- * and returns the kaddr corresponding to first physical page in the
- * node's mem_map.
- */
-#define LOCAL_BASE_ADDR(kaddr) \
- ((unsigned long)__va(NODE_DATA(kvaddr_to_nid(kaddr))->node_start_pfn \
- << PAGE_SHIFT))
-
/* XXX: FIXME -- wli */
#define kern_addr_valid(kaddr) (0)
@@ -106,8 +90,9 @@
#define pfn_to_page(pfn) \
({ \
- unsigned long kaddr = (unsigned long)__va((pfn) << PAGE_SHIFT); \
- (NODE_DATA(kvaddr_to_nid(kaddr))->node_mem_map + local_mapnr(kaddr)); \
+ unsigned long __tmp = pfn; \
+ (NODE_DATA(pfn_to_nid(__tmp))->node_mem_map + \
+ node_localnr(__tmp, pfn_to_nid(__tmp))); \
})
#define page_to_pfn(page) \
Index: build/include/asm-i386/mmzone.h
===================================================================
--- build.orig/include/asm-i386/mmzone.h 2005-09-13 12:48:54.000000000 +1000
+++ build/include/asm-i386/mmzone.h 2005-09-13 12:49:25.000000000 +1000
@@ -76,11 +76,6 @@
* Following are macros that each numa implmentation must define.
*/
-/*
- * Given a kernel address, find the home node of the underlying memory.
- */
-#define kvaddr_to_nid(kaddr) pfn_to_nid(__pa(kaddr) >> PAGE_SHIFT)
-
#define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn)
#define node_end_pfn(nid) \
({ \
@@ -88,12 +83,6 @@
__pgdat->node_start_pfn + __pgdat->node_spanned_pages; \
})
-#define local_mapnr(kvaddr) \
-({ \
- unsigned long __pfn = __pa(kvaddr) >> PAGE_SHIFT; \
- (__pfn - node_start_pfn(pfn_to_nid(__pfn))); \
-})
-
/* XXX: FIXME -- wli */
#define kern_addr_valid(kaddr) (0)
Index: build/include/asm-mips/mmzone.h
===================================================================
--- build.orig/include/asm-mips/mmzone.h 2005-09-13 12:48:54.000000000 +1000
+++ build/include/asm-mips/mmzone.h 2005-09-13 12:49:25.000000000 +1000
@@ -10,7 +10,6 @@
#ifdef CONFIG_DISCONTIGMEM
-#define kvaddr_to_nid(kvaddr) pa_to_nid(__pa(kvaddr))
#define pfn_to_nid(pfn) pa_to_nid((pfn) << PAGE_SHIFT)
#define pfn_valid(pfn) \
Index: build/include/asm-parisc/mmzone.h
===================================================================
--- build.orig/include/asm-parisc/mmzone.h 2005-09-13 12:48:54.000000000 +1000
+++ build/include/asm-parisc/mmzone.h 2005-09-13 12:49:25.000000000 +1000
@@ -14,11 +14,6 @@
#define NODE_DATA(nid) (&node_data[nid].pg_data)
-/*
- * Given a kernel address, find the home node of the underlying memory.
- */
-#define kvaddr_to_nid(kaddr) pfn_to_nid(__pa(kaddr) >> PAGE_SHIFT)
-
#define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn)
#define node_end_pfn(nid) \
({ \
@@ -27,12 +22,6 @@
})
#define node_localnr(pfn, nid) ((pfn) - node_start_pfn(nid))
-#define local_mapnr(kvaddr) \
-({ \
- unsigned long __pfn = __pa(kvaddr) >> PAGE_SHIFT; \
- (__pfn - node_start_pfn(pfn_to_nid(__pfn))); \
-})
-
#define pfn_to_page(pfn) \
({ \
unsigned long __pfn = (pfn); \
Index: build/include/asm-ppc64/mmzone.h
===================================================================
--- build.orig/include/asm-ppc64/mmzone.h 2005-09-13 12:48:54.000000000 +1000
+++ build/include/asm-ppc64/mmzone.h 2005-09-13 12:49:25.000000000 +1000
@@ -58,8 +58,6 @@
return nid;
}
-#define node_localnr(pfn, nid) ((pfn) - NODE_DATA(nid)->node_start_pfn)
-
/*
* Following are macros that each numa implmentation must define.
*/
@@ -67,15 +65,9 @@
#define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn)
#define node_end_pfn(nid) (NODE_DATA(nid)->node_end_pfn)
-#define local_mapnr(kvaddr) \
- ( (__pa(kvaddr) >> PAGE_SHIFT) - node_start_pfn(kvaddr_to_nid(kvaddr))
-
#ifdef CONFIG_DISCONTIGMEM
-/*
- * Given a kernel address, find the home node of the underlying memory.
- */
-#define kvaddr_to_nid(kaddr) pa_to_nid(__pa(kaddr))
+#define node_localnr(pfn, nid) ((pfn) - NODE_DATA(nid)->node_start_pfn)
#define pfn_to_nid(pfn) pa_to_nid((unsigned long)(pfn) << PAGE_SHIFT)
Index: build/include/asm-x86_64/mmzone.h
===================================================================
--- build.orig/include/asm-x86_64/mmzone.h 2005-09-13 12:48:54.000000000 +1000
+++ build/include/asm-x86_64/mmzone.h 2005-09-13 12:49:25.000000000 +1000
@@ -39,7 +39,6 @@
#ifdef CONFIG_DISCONTIGMEM
#define pfn_to_nid(pfn) phys_to_nid((unsigned long)(pfn) << PAGE_SHIFT)
-#define kvaddr_to_nid(kaddr) phys_to_nid(__pa(kaddr))
/* AK: this currently doesn't deal with invalid addresses. We'll see
if the 2.5 kernel doesn't pass them
@@ -57,7 +56,5 @@
nid__ != 0xff && (pfn) >= node_start_pfn(nid__) && (pfn) < node_end_pfn(nid__); }))
#endif
-#define local_mapnr(kvaddr) \
- ( (__pa(kvaddr) >> PAGE_SHIFT) - node_start_pfn(kvaddr_to_nid(kvaddr)) )
#endif
#endif
Index: build/include/linux/mmzone.h
===================================================================
--- build.orig/include/linux/mmzone.h 2005-09-13 12:48:54.000000000 +1000
+++ build/include/linux/mmzone.h 2005-09-13 12:49:25.000000000 +1000
@@ -542,11 +542,6 @@
return valid_section(__nr_to_section(nr));
}
-/*
- * Given a kernel address, find the home node of the underlying memory.
- */
-#define kvaddr_to_nid(kaddr) pfn_to_nid(__pa(kaddr) >> PAGE_SHIFT)
-
static inline struct mem_section *__pfn_to_section(unsigned long pfn)
{
return __nr_to_section(pfn_to_section_nr(pfn));
Index: build/include/asm-m32r/mmzone.h
===================================================================
--- build.orig/include/asm-m32r/mmzone.h 2005-09-13 12:48:54.000000000 +1000
+++ build/include/asm-m32r/mmzone.h 2005-09-13 12:49:25.000000000 +1000
@@ -21,12 +21,6 @@
__pgdat->node_start_pfn + __pgdat->node_spanned_pages - 1; \
})
-#define local_mapnr(kvaddr) \
-({ \
- unsigned long __pfn = __pa(kvaddr) >> PAGE_SHIFT; \
- (__pfn - node_start_pfn(pfn_to_nid(__pfn))); \
-})
-
#define pfn_to_page(pfn) \
({ \
unsigned long __pfn = pfn; \
More information about the Linuxppc64-dev
mailing list