aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-x86_64/mmzone.h
diff options
context:
space:
mode:
authorMatt Tolentino <metolent@snoqualmie.dp.intel.com>2005-06-23 03:08:06 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-23 12:45:06 -0400
commit2b97690f4cd960779fb351b7cd9974390afabb36 (patch)
tree26a94d00bc67f3036cea966ba7435f8e1efd3779 /include/asm-x86_64/mmzone.h
parent1035faf1b19efb83d5626985240f52cd149dd39b (diff)
[PATCH] reorganize x86-64 NUMA and DISCONTIGMEM config options
In order to use the alternative sparsemem implmentation for NUMA kernels, we need to reorganize the config options. This patch effectively abstracts out the CONFIG_DISCONTIGMEM options to CONFIG_NUMA in most cases. Thus, the discontigmem implementation may be employed as always, but the sparsemem implementation may be used alternatively. Signed-off-by: Matt Tolentino <matthew.e.tolentino@intel.com> Signed-off-by: Dave Hansen <haveblue@us.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/asm-x86_64/mmzone.h')
-rw-r--r--include/asm-x86_64/mmzone.h15
1 files changed, 9 insertions, 6 deletions
diff --git a/include/asm-x86_64/mmzone.h b/include/asm-x86_64/mmzone.h
index ca4fc3fe0dee..768413751b34 100644
--- a/include/asm-x86_64/mmzone.h
+++ b/include/asm-x86_64/mmzone.h
@@ -6,7 +6,7 @@
6 6
7#include <linux/config.h> 7#include <linux/config.h>
8 8
9#ifdef CONFIG_DISCONTIGMEM 9#ifdef CONFIG_NUMA
10 10
11#define VIRTUAL_BUG_ON(x) 11#define VIRTUAL_BUG_ON(x)
12 12
@@ -30,17 +30,16 @@ static inline __attribute__((pure)) int phys_to_nid(unsigned long addr)
30 return nid; 30 return nid;
31} 31}
32 32
33#define pfn_to_nid(pfn) phys_to_nid((unsigned long)(pfn) << PAGE_SHIFT)
34
35#define kvaddr_to_nid(kaddr) phys_to_nid(__pa(kaddr))
36#define NODE_DATA(nid) (node_data[nid]) 33#define NODE_DATA(nid) (node_data[nid])
37 34
38#define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) 35#define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn)
39#define node_end_pfn(nid) (NODE_DATA(nid)->node_start_pfn + \ 36#define node_end_pfn(nid) (NODE_DATA(nid)->node_start_pfn + \
40 NODE_DATA(nid)->node_spanned_pages) 37 NODE_DATA(nid)->node_spanned_pages)
41 38
42#define local_mapnr(kvaddr) \ 39#ifdef CONFIG_DISCONTIGMEM
43 ( (__pa(kvaddr) >> PAGE_SHIFT) - node_start_pfn(kvaddr_to_nid(kvaddr)) ) 40
41#define pfn_to_nid(pfn) phys_to_nid((unsigned long)(pfn) << PAGE_SHIFT)
42#define kvaddr_to_nid(kaddr) phys_to_nid(__pa(kaddr))
44 43
45/* AK: this currently doesn't deal with invalid addresses. We'll see 44/* AK: this currently doesn't deal with invalid addresses. We'll see
46 if the 2.5 kernel doesn't pass them 45 if the 2.5 kernel doesn't pass them
@@ -57,4 +56,8 @@ static inline __attribute__((pure)) int phys_to_nid(unsigned long addr)
57 ({ u8 nid__ = pfn_to_nid(pfn); \ 56 ({ u8 nid__ = pfn_to_nid(pfn); \
58 nid__ != 0xff && (pfn) >= node_start_pfn(nid__) && (pfn) <= node_end_pfn(nid__); })) 57 nid__ != 0xff && (pfn) >= node_start_pfn(nid__) && (pfn) <= node_end_pfn(nid__); }))
59#endif 58#endif
59
60#define local_mapnr(kvaddr) \
61 ( (__pa(kvaddr) >> PAGE_SHIFT) - node_start_pfn(kvaddr_to_nid(kvaddr)) )
62#endif
60#endif 63#endif