diff options
author | Tejun Heo <tj@kernel.org> | 2009-02-23 21:57:20 -0500 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2009-02-23 21:57:20 -0500 |
commit | c132937556f56ee4b831ef4b23f1846e05fde102 (patch) | |
tree | 0f93037ff2ebbdc321ebd0bbfc4752823c8d6a0e /arch/x86/include/asm/mmzone_32.h | |
parent | cb83b42e23bd6c4bf91793a320fbe83787c13596 (diff) |
bootmem: clean up arch-specific bootmem wrapping
Impact: cleaner and consistent bootmem wrapping
By setting CONFIG_HAVE_ARCH_BOOTMEM_NODE, archs can define
arch-specific wrappers for bootmem allocation. However, this is done
a bit strangely in that only the high level convenience macros can be
changed while lower level, but still exported, interface functions
can't be wrapped. This not only is messy but also leads to strange
situation where alloc_bootmem() does what the arch wants it to do but
the equivalent __alloc_bootmem() call doesn't although they should be
able to be used interchangeably.
This patch updates bootmem such that archs can override / wrap the
backend function - alloc_bootmem_core() instead of the highlevel
interface functions to allow simpler and consistent wrapping. Also,
HAVE_ARCH_BOOTMEM_NODE is renamed to HAVE_ARCH_BOOTMEM.
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Johannes Weiner <hannes@saeurebad.de>
Diffstat (limited to 'arch/x86/include/asm/mmzone_32.h')
-rw-r--r-- | arch/x86/include/asm/mmzone_32.h | 43 |
1 files changed, 5 insertions, 38 deletions
diff --git a/arch/x86/include/asm/mmzone_32.h b/arch/x86/include/asm/mmzone_32.h index 07f1af494ca5..1e0fa9e63afa 100644 --- a/arch/x86/include/asm/mmzone_32.h +++ b/arch/x86/include/asm/mmzone_32.h | |||
@@ -93,45 +93,12 @@ static inline int pfn_valid(int pfn) | |||
93 | #endif /* CONFIG_DISCONTIGMEM */ | 93 | #endif /* CONFIG_DISCONTIGMEM */ |
94 | 94 | ||
95 | #ifdef CONFIG_NEED_MULTIPLE_NODES | 95 | #ifdef CONFIG_NEED_MULTIPLE_NODES |
96 | 96 | /* always use node 0 for bootmem on this numa platform */ | |
97 | /* | 97 | #define alloc_bootmem_core(__bdata, size, align, goal, limit) \ |
98 | * Following are macros that are specific to this numa platform. | ||
99 | */ | ||
100 | #define reserve_bootmem(addr, size, flags) \ | ||
101 | reserve_bootmem_node(NODE_DATA(0), (addr), (size), (flags)) | ||
102 | #define alloc_bootmem(x) \ | ||
103 | __alloc_bootmem_node(NODE_DATA(0), (x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) | ||
104 | #define alloc_bootmem_nopanic(x) \ | ||
105 | __alloc_bootmem_node_nopanic(NODE_DATA(0), (x), SMP_CACHE_BYTES, \ | ||
106 | __pa(MAX_DMA_ADDRESS)) | ||
107 | #define alloc_bootmem_low(x) \ | ||
108 | __alloc_bootmem_node(NODE_DATA(0), (x), SMP_CACHE_BYTES, 0) | ||
109 | #define alloc_bootmem_pages(x) \ | ||
110 | __alloc_bootmem_node(NODE_DATA(0), (x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) | ||
111 | #define alloc_bootmem_pages_nopanic(x) \ | ||
112 | __alloc_bootmem_node_nopanic(NODE_DATA(0), (x), PAGE_SIZE, \ | ||
113 | __pa(MAX_DMA_ADDRESS)) | ||
114 | #define alloc_bootmem_low_pages(x) \ | ||
115 | __alloc_bootmem_node(NODE_DATA(0), (x), PAGE_SIZE, 0) | ||
116 | #define alloc_bootmem_node(pgdat, x) \ | ||
117 | ({ \ | ||
118 | struct pglist_data __maybe_unused \ | ||
119 | *__alloc_bootmem_node__pgdat = (pgdat); \ | ||
120 | __alloc_bootmem_node(NODE_DATA(0), (x), SMP_CACHE_BYTES, \ | ||
121 | __pa(MAX_DMA_ADDRESS)); \ | ||
122 | }) | ||
123 | #define alloc_bootmem_pages_node(pgdat, x) \ | ||
124 | ({ \ | ||
125 | struct pglist_data __maybe_unused \ | ||
126 | *__alloc_bootmem_node__pgdat = (pgdat); \ | ||
127 | __alloc_bootmem_node(NODE_DATA(0), (x), PAGE_SIZE, \ | ||
128 | __pa(MAX_DMA_ADDRESS)); \ | ||
129 | }) | ||
130 | #define alloc_bootmem_low_pages_node(pgdat, x) \ | ||
131 | ({ \ | 98 | ({ \ |
132 | struct pglist_data __maybe_unused \ | 99 | bootmem_data_t __maybe_unused * __abm_bdata_dummy = (__bdata); \ |
133 | *__alloc_bootmem_node__pgdat = (pgdat); \ | 100 | __alloc_bootmem_core(NODE_DATA(0)->bdata, \ |
134 | __alloc_bootmem_node(NODE_DATA(0), (x), PAGE_SIZE, 0); \ | 101 | (size), (align), (goal), (limit)); \ |
135 | }) | 102 | }) |
136 | #endif /* CONFIG_NEED_MULTIPLE_NODES */ | 103 | #endif /* CONFIG_NEED_MULTIPLE_NODES */ |
137 | 104 | ||