]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] x86_64: Move NUMA page_to_pfn/pfn_to_page functions out of line
authorAndi Kleen <ak@suse.de>
Wed, 11 Jan 2006 21:46:27 +0000 (22:46 +0100)
committerLinus Torvalds <torvalds@g5.osdl.org>
Thu, 12 Jan 2006 03:05:01 +0000 (19:05 -0800)
Saves about ~18K .text in defconfig

There would be more optimization potential, but that's for later.

Suggestion originally from Bill Irwin.
Fix from Andy Whitcroft.

Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
arch/x86_64/mm/numa.c
include/asm-x86_64/mmzone.h

index 994dbaeb33f0f7b5ab4b5ef572fe0efaceb06dec..6ef9f9a762356c955fe3927fbed882b663e0dd2e 100644 (file)
@@ -360,3 +360,39 @@ EXPORT_SYMBOL(node_to_cpumask);
 EXPORT_SYMBOL(memnode_shift);
 EXPORT_SYMBOL(memnodemap);
 EXPORT_SYMBOL(node_data);
+
+#ifdef CONFIG_DISCONTIGMEM
+/*
+ * Functions to convert PFNs from/to per node page addresses.
+ * These are out of line because they are quite big.
+ * They could be all tuned by pre caching more state.
+ * Should do that.
+ */
+
+/* Requires pfn_valid(pfn) to be true */
+struct page *pfn_to_page(unsigned long pfn)
+{
+       int nid = phys_to_nid(((unsigned long)(pfn)) << PAGE_SHIFT);
+       return (pfn - node_start_pfn(nid)) + NODE_DATA(nid)->node_mem_map;
+}
+EXPORT_SYMBOL(pfn_to_page);
+
+unsigned long page_to_pfn(struct page *page)
+{
+       return (long)(((page) - page_zone(page)->zone_mem_map) +
+                     page_zone(page)->zone_start_pfn);
+}
+EXPORT_SYMBOL(page_to_pfn);
+
+int pfn_valid(unsigned long pfn)
+{
+       unsigned nid;
+       if (pfn >= num_physpages)
+               return 0;
+       nid = pfn_to_nid(pfn);
+       if (nid == 0xff)
+               return 0;
+       return pfn >= node_start_pfn(nid) && (pfn) < node_end_pfn(nid);
+}
+EXPORT_SYMBOL(pfn_valid);
+#endif
index 69baaa8a3ce0078b5f9226b218bc0944272bc9c4..972c9359f7d739ff5ffe4f34b2450a218faeaeab 100644 (file)
@@ -36,22 +36,12 @@ static inline __attribute__((pure)) int phys_to_nid(unsigned long addr)
                                 NODE_DATA(nid)->node_spanned_pages)
 
 #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))
 
-/* Requires pfn_valid(pfn) to be true */
-#define pfn_to_page(pfn) ({ \
-       int nid = phys_to_nid(((unsigned long)(pfn)) << PAGE_SHIFT);    \
-       ((pfn) - node_start_pfn(nid)) + NODE_DATA(nid)->node_mem_map;   \
-})
-
-#define page_to_pfn(page) \
-       (long)(((page) - page_zone(page)->zone_mem_map) + page_zone(page)->zone_start_pfn)
-
-#define pfn_valid(pfn) ((pfn) >= num_physpages ? 0 : \
-                       ({ u8 nid__ = pfn_to_nid(pfn); \
-                          nid__ != 0xff && (pfn) >= node_start_pfn(nid__) && (pfn) < node_end_pfn(nid__); }))
+extern struct page *pfn_to_page(unsigned long pfn);
+extern unsigned long page_to_pfn(struct page *page);
+extern int pfn_valid(unsigned long pfn);
 #endif
 
 #define local_mapnr(kvaddr) \