diff options
author | Christoph Lameter <clameter@sgi.com> | 2008-04-28 05:12:54 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-28 11:58:22 -0400 |
commit | 97965478a66fbdf0f4ad5e4ecc4828f0cb548a45 (patch) | |
tree | a60bb6c46acdc35d16b2e48f5c13248fc009b35e /include/linux/mmzone.h | |
parent | ec7cade8c1a3d1ace69b35cc843b181818578dce (diff) |
mm: Get rid of __ZONE_COUNT
It was used to compensate because MAX_NR_ZONES was not available to the
#ifdefs. Export MAX_NR_ZONES via the new mechanism and get rid of
__ZONE_COUNT.
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/mmzone.h')
-rw-r--r-- | include/linux/mmzone.h | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index c7a51dac441d..c3828497f41d 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h | |||
@@ -3,6 +3,7 @@ | |||
3 | 3 | ||
4 | #ifdef __KERNEL__ | 4 | #ifdef __KERNEL__ |
5 | #ifndef __ASSEMBLY__ | 5 | #ifndef __ASSEMBLY__ |
6 | #ifndef __GENERATING_BOUNDS_H | ||
6 | 7 | ||
7 | #include <linux/spinlock.h> | 8 | #include <linux/spinlock.h> |
8 | #include <linux/list.h> | 9 | #include <linux/list.h> |
@@ -15,6 +16,7 @@ | |||
15 | #include <linux/seqlock.h> | 16 | #include <linux/seqlock.h> |
16 | #include <linux/nodemask.h> | 17 | #include <linux/nodemask.h> |
17 | #include <linux/pageblock-flags.h> | 18 | #include <linux/pageblock-flags.h> |
19 | #include <linux/bounds.h> | ||
18 | #include <asm/atomic.h> | 20 | #include <asm/atomic.h> |
19 | #include <asm/page.h> | 21 | #include <asm/page.h> |
20 | 22 | ||
@@ -129,6 +131,8 @@ struct per_cpu_pageset { | |||
129 | #define zone_pcp(__z, __cpu) (&(__z)->pageset[(__cpu)]) | 131 | #define zone_pcp(__z, __cpu) (&(__z)->pageset[(__cpu)]) |
130 | #endif | 132 | #endif |
131 | 133 | ||
134 | #endif /* !__GENERATING_BOUNDS.H */ | ||
135 | |||
132 | enum zone_type { | 136 | enum zone_type { |
133 | #ifdef CONFIG_ZONE_DMA | 137 | #ifdef CONFIG_ZONE_DMA |
134 | /* | 138 | /* |
@@ -177,9 +181,11 @@ enum zone_type { | |||
177 | ZONE_HIGHMEM, | 181 | ZONE_HIGHMEM, |
178 | #endif | 182 | #endif |
179 | ZONE_MOVABLE, | 183 | ZONE_MOVABLE, |
180 | MAX_NR_ZONES | 184 | __MAX_NR_ZONES |
181 | }; | 185 | }; |
182 | 186 | ||
187 | #ifndef __GENERATING_BOUNDS_H | ||
188 | |||
183 | /* | 189 | /* |
184 | * When a memory allocation must conform to specific limitations (such | 190 | * When a memory allocation must conform to specific limitations (such |
185 | * as being suitable for DMA) the caller will pass in hints to the | 191 | * as being suitable for DMA) the caller will pass in hints to the |
@@ -188,28 +194,15 @@ enum zone_type { | |||
188 | * match the requested limits. See gfp_zone() in include/linux/gfp.h | 194 | * match the requested limits. See gfp_zone() in include/linux/gfp.h |
189 | */ | 195 | */ |
190 | 196 | ||
191 | /* | 197 | #if MAX_NR_ZONES < 2 |
192 | * Count the active zones. Note that the use of defined(X) outside | ||
193 | * #if and family is not necessarily defined so ensure we cannot use | ||
194 | * it later. Use __ZONE_COUNT to work out how many shift bits we need. | ||
195 | */ | ||
196 | #define __ZONE_COUNT ( \ | ||
197 | defined(CONFIG_ZONE_DMA) \ | ||
198 | + defined(CONFIG_ZONE_DMA32) \ | ||
199 | + 1 \ | ||
200 | + defined(CONFIG_HIGHMEM) \ | ||
201 | + 1 \ | ||
202 | ) | ||
203 | #if __ZONE_COUNT < 2 | ||
204 | #define ZONES_SHIFT 0 | 198 | #define ZONES_SHIFT 0 |
205 | #elif __ZONE_COUNT <= 2 | 199 | #elif MAX_NR_ZONES <= 2 |
206 | #define ZONES_SHIFT 1 | 200 | #define ZONES_SHIFT 1 |
207 | #elif __ZONE_COUNT <= 4 | 201 | #elif MAX_NR_ZONES <= 4 |
208 | #define ZONES_SHIFT 2 | 202 | #define ZONES_SHIFT 2 |
209 | #else | 203 | #else |
210 | #error ZONES_SHIFT -- too many zones configured adjust calculation | 204 | #error ZONES_SHIFT -- too many zones configured adjust calculation |
211 | #endif | 205 | #endif |
212 | #undef __ZONE_COUNT | ||
213 | 206 | ||
214 | struct zone { | 207 | struct zone { |
215 | /* Fields commonly accessed by the page allocator */ | 208 | /* Fields commonly accessed by the page allocator */ |
@@ -1008,6 +1001,7 @@ unsigned long __init node_memmap_size_bytes(int, unsigned long, unsigned long); | |||
1008 | #define pfn_valid_within(pfn) (1) | 1001 | #define pfn_valid_within(pfn) (1) |
1009 | #endif | 1002 | #endif |
1010 | 1003 | ||
1004 | #endif /* !__GENERATING_BOUNDS.H */ | ||
1011 | #endif /* !__ASSEMBLY__ */ | 1005 | #endif /* !__ASSEMBLY__ */ |
1012 | #endif /* __KERNEL__ */ | 1006 | #endif /* __KERNEL__ */ |
1013 | #endif /* _LINUX_MMZONE_H */ | 1007 | #endif /* _LINUX_MMZONE_H */ |