aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mmzone.h
diff options
context:
space:
mode:
authorChristoph Lameter <clameter@sgi.com>2007-02-10 04:43:10 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-11 13:51:18 -0500
commit4b51d66989218aad731a721b5b28c79bf5388c09 (patch)
tree8ff7acbd219f699c20c2f1fd201ffb3db5a64062 /include/linux/mmzone.h
parent66701b1499a3ff11882c8c4aef36e8eac86e17b1 (diff)
[PATCH] optional ZONE_DMA: optional ZONE_DMA in the VM
Make ZONE_DMA optional in core code. - ifdef all code for ZONE_DMA and related definitions following the example for ZONE_DMA32 and ZONE_HIGHMEM. - Without ZONE_DMA, ZONE_HIGHMEM and ZONE_DMA32 we get to a ZONES_SHIFT of 0. - Modify the VM statistics to work correctly without a DMA zone. - Modify slab to not create DMA slabs if there is no ZONE_DMA. [akpm@osdl.org: cleanup] [jdike@addtoit.com: build fix] [apw@shadowen.org: Simplify calculation of the number of bits we need for ZONES_SHIFT] Signed-off-by: Christoph Lameter <clameter@sgi.com> Cc: Andi Kleen <ak@suse.de> Cc: "Luck, Tony" <tony.luck@intel.com> Cc: Kyle McMartin <kyle@mcmartin.ca> Cc: Matthew Wilcox <willy@debian.org> Cc: James Bottomley <James.Bottomley@steeleye.com> Cc: Paul Mundt <lethal@linux-sh.org> Signed-off-by: Andy Whitcroft <apw@shadowen.org> Signed-off-by: Jeff Dike <jdike@addtoit.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.h26
1 files changed, 24 insertions, 2 deletions
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 398f2ec55f54..ee9e3143df4f 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -96,6 +96,7 @@ struct per_cpu_pageset {
96#endif 96#endif
97 97
98enum zone_type { 98enum zone_type {
99#ifdef CONFIG_ZONE_DMA
99 /* 100 /*
100 * ZONE_DMA is used when there are devices that are not able 101 * ZONE_DMA is used when there are devices that are not able
101 * to do DMA to all of addressable memory (ZONE_NORMAL). Then we 102 * to do DMA to all of addressable memory (ZONE_NORMAL). Then we
@@ -116,6 +117,7 @@ enum zone_type {
116 * <16M. 117 * <16M.
117 */ 118 */
118 ZONE_DMA, 119 ZONE_DMA,
120#endif
119#ifdef CONFIG_ZONE_DMA32 121#ifdef CONFIG_ZONE_DMA32
120 /* 122 /*
121 * x86_64 needs two ZONE_DMAs because it supports devices that are 123 * x86_64 needs two ZONE_DMAs because it supports devices that are
@@ -152,11 +154,27 @@ enum zone_type {
152 * match the requested limits. See gfp_zone() in include/linux/gfp.h 154 * match the requested limits. See gfp_zone() in include/linux/gfp.h
153 */ 155 */
154 156
155#if !defined(CONFIG_ZONE_DMA32) && !defined(CONFIG_HIGHMEM) 157/*
158 * Count the active zones. Note that the use of defined(X) outside
159 * #if and family is not necessarily defined so ensure we cannot use
160 * it later. Use __ZONE_COUNT to work out how many shift bits we need.
161 */
162#define __ZONE_COUNT ( \
163 defined(CONFIG_ZONE_DMA) \
164 + defined(CONFIG_ZONE_DMA32) \
165 + 1 \
166 + defined(CONFIG_HIGHMEM) \
167)
168#if __ZONE_COUNT < 2
169#define ZONES_SHIFT 0
170#elif __ZONE_COUNT <= 2
156#define ZONES_SHIFT 1 171#define ZONES_SHIFT 1
157#else 172#elif __ZONE_COUNT <= 4
158#define ZONES_SHIFT 2 173#define ZONES_SHIFT 2
174#else
175#error ZONES_SHIFT -- too many zones configured adjust calculation
159#endif 176#endif
177#undef __ZONE_COUNT
160 178
161struct zone { 179struct zone {
162 /* Fields commonly accessed by the page allocator */ 180 /* Fields commonly accessed by the page allocator */
@@ -523,7 +541,11 @@ static inline int is_dma32(struct zone *zone)
523 541
524static inline int is_dma(struct zone *zone) 542static inline int is_dma(struct zone *zone)
525{ 543{
544#ifdef CONFIG_ZONE_DMA
526 return zone == zone->zone_pgdat->node_zones + ZONE_DMA; 545 return zone == zone->zone_pgdat->node_zones + ZONE_DMA;
546#else
547 return 0;
548#endif
527} 549}
528 550
529/* These two functions are used to setup the per zone pages min values */ 551/* These two functions are used to setup the per zone pages min values */