]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - include/asm-x86_64/mmzone.h
[PATCH] kprobes: arch_remove_kprobe
[linux-2.6-omap-h63xx.git] / include / asm-x86_64 / mmzone.h
index 768413751b34288c0eb6b1ae5b56f4c5eecb3d13..69baaa8a3ce0078b5f9226b218bc0944272bc9c4 100644 (file)
 
 #include <asm/smp.h>
 
-#define NODEMAPSIZE 0xff
+#define NODEMAPSIZE 0xfff
 
 /* Simple perfect hash to map physical addresses to node numbers */
 extern int memnode_shift; 
 extern u8  memnodemap[NODEMAPSIZE]; 
-extern int maxnode;
 
 extern struct pglist_data *node_data[];
 
 static inline __attribute__((pure)) int phys_to_nid(unsigned long addr) 
 { 
-       int nid; 
+       unsigned nid; 
        VIRTUAL_BUG_ON((addr >> memnode_shift) >= NODEMAPSIZE);
        nid = memnodemap[addr >> memnode_shift]; 
-       VIRTUAL_BUG_ON(nid > maxnode); 
+       VIRTUAL_BUG_ON(nid >= MAX_NUMNODES || !node_data[nid]); 
        return nid; 
 } 
 
@@ -41,9 +40,7 @@ static inline __attribute__((pure)) int phys_to_nid(unsigned long addr)
 #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
-   (2.4 used to). */
+/* 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;   \
@@ -54,7 +51,7 @@ static inline __attribute__((pure)) int phys_to_nid(unsigned long addr)
 
 #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__); }))
+                          nid__ != 0xff && (pfn) >= node_start_pfn(nid__) && (pfn) < node_end_pfn(nid__); }))
 #endif
 
 #define local_mapnr(kvaddr) \