aboutsummaryrefslogtreecommitdiffstats
path: root/include
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
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')
-rw-r--r--include/asm-x86_64/io.h5
-rw-r--r--include/asm-x86_64/mmzone.h15
-rw-r--r--include/asm-x86_64/page.h4
-rw-r--r--include/asm-x86_64/topology.h4
4 files changed, 13 insertions, 15 deletions
diff --git a/include/asm-x86_64/io.h b/include/asm-x86_64/io.h
index 94202703fae2..37fc3f149a5a 100644
--- a/include/asm-x86_64/io.h
+++ b/include/asm-x86_64/io.h
@@ -124,12 +124,7 @@ extern inline void * phys_to_virt(unsigned long address)
124/* 124/*
125 * Change "struct page" to physical address. 125 * Change "struct page" to physical address.
126 */ 126 */
127#ifdef CONFIG_DISCONTIGMEM
128#include <asm/mmzone.h>
129#define page_to_phys(page) ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT) 127#define page_to_phys(page) ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT)
130#else
131#define page_to_phys(page) ((page - mem_map) << PAGE_SHIFT)
132#endif
133 128
134#include <asm-generic/iomap.h> 129#include <asm-generic/iomap.h>
135 130
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
diff --git a/include/asm-x86_64/page.h b/include/asm-x86_64/page.h
index 9ce338c3a71e..60130f4ca986 100644
--- a/include/asm-x86_64/page.h
+++ b/include/asm-x86_64/page.h
@@ -119,7 +119,9 @@ extern __inline__ int get_order(unsigned long size)
119 __pa(v); }) 119 __pa(v); })
120 120
121#define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET)) 121#define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET))
122#ifndef CONFIG_DISCONTIGMEM 122#define __boot_va(x) __va(x)
123#define __boot_pa(x) __pa(x)
124#ifdef CONFIG_FLATMEM
123#define pfn_to_page(pfn) (mem_map + (pfn)) 125#define pfn_to_page(pfn) (mem_map + (pfn))
124#define page_to_pfn(page) ((unsigned long)((page) - mem_map)) 126#define page_to_pfn(page) ((unsigned long)((page) - mem_map))
125#define pfn_valid(pfn) ((pfn) < max_mapnr) 127#define pfn_valid(pfn) ((pfn) < max_mapnr)
diff --git a/include/asm-x86_64/topology.h b/include/asm-x86_64/topology.h
index 67f24e0ea819..da21573ec731 100644
--- a/include/asm-x86_64/topology.h
+++ b/include/asm-x86_64/topology.h
@@ -3,7 +3,7 @@
3 3
4#include <linux/config.h> 4#include <linux/config.h>
5 5
6#ifdef CONFIG_DISCONTIGMEM 6#ifdef CONFIG_NUMA
7 7
8#include <asm/mpspec.h> 8#include <asm/mpspec.h>
9#include <asm/bitops.h> 9#include <asm/bitops.h>
@@ -37,7 +37,6 @@ static inline cpumask_t __pcibus_to_cpumask(int bus)
37} 37}
38#define pcibus_to_cpumask(bus) __pcibus_to_cpumask(bus->number) 38#define pcibus_to_cpumask(bus) __pcibus_to_cpumask(bus->number)
39 39
40#ifdef CONFIG_NUMA
41/* sched_domains SD_NODE_INIT for x86_64 machines */ 40/* sched_domains SD_NODE_INIT for x86_64 machines */
42#define SD_NODE_INIT (struct sched_domain) { \ 41#define SD_NODE_INIT (struct sched_domain) { \
43 .span = CPU_MASK_NONE, \ 42 .span = CPU_MASK_NONE, \
@@ -59,7 +58,6 @@ static inline cpumask_t __pcibus_to_cpumask(int bus)
59 .balance_interval = 1, \ 58 .balance_interval = 1, \
60 .nr_balance_failed = 0, \ 59 .nr_balance_failed = 0, \
61} 60}
62#endif
63 61
64#endif 62#endif
65 63