diff options
author | Christoph Lameter <clameter@sgi.com> | 2007-02-10 04:43:10 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-11 13:51:18 -0500 |
commit | 4b51d66989218aad731a721b5b28c79bf5388c09 (patch) | |
tree | 8ff7acbd219f699c20c2f1fd201ffb3db5a64062 /mm | |
parent | 66701b1499a3ff11882c8c4aef36e8eac86e17b1 (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 'mm')
-rw-r--r-- | mm/Kconfig | 6 | ||||
-rw-r--r-- | mm/page_alloc.c | 4 | ||||
-rw-r--r-- | mm/slab.c | 20 | ||||
-rw-r--r-- | mm/vmstat.c | 8 |
4 files changed, 30 insertions, 8 deletions
diff --git a/mm/Kconfig b/mm/Kconfig index 50f7cfc15b78..79360cf519bf 100644 --- a/mm/Kconfig +++ b/mm/Kconfig | |||
@@ -161,3 +161,9 @@ config RESOURCES_64BIT | |||
161 | default 64BIT | 161 | default 64BIT |
162 | help | 162 | help |
163 | This option allows memory and IO resources to be 64 bit. | 163 | This option allows memory and IO resources to be 64 bit. |
164 | |||
165 | config ZONE_DMA_FLAG | ||
166 | int | ||
167 | default "0" if !ZONE_DMA | ||
168 | default "1" | ||
169 | |||
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 6cff13840c6d..d461b23a27a1 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -73,7 +73,9 @@ static void __free_pages_ok(struct page *page, unsigned int order); | |||
73 | * don't need any ZONE_NORMAL reservation | 73 | * don't need any ZONE_NORMAL reservation |
74 | */ | 74 | */ |
75 | int sysctl_lowmem_reserve_ratio[MAX_NR_ZONES-1] = { | 75 | int sysctl_lowmem_reserve_ratio[MAX_NR_ZONES-1] = { |
76 | #ifdef CONFIG_ZONE_DMA | ||
76 | 256, | 77 | 256, |
78 | #endif | ||
77 | #ifdef CONFIG_ZONE_DMA32 | 79 | #ifdef CONFIG_ZONE_DMA32 |
78 | 256, | 80 | 256, |
79 | #endif | 81 | #endif |
@@ -85,7 +87,9 @@ int sysctl_lowmem_reserve_ratio[MAX_NR_ZONES-1] = { | |||
85 | EXPORT_SYMBOL(totalram_pages); | 87 | EXPORT_SYMBOL(totalram_pages); |
86 | 88 | ||
87 | static char * const zone_names[MAX_NR_ZONES] = { | 89 | static char * const zone_names[MAX_NR_ZONES] = { |
90 | #ifdef CONFIG_ZONE_DMA | ||
88 | "DMA", | 91 | "DMA", |
92 | #endif | ||
89 | #ifdef CONFIG_ZONE_DMA32 | 93 | #ifdef CONFIG_ZONE_DMA32 |
90 | "DMA32", | 94 | "DMA32", |
91 | #endif | 95 | #endif |
@@ -793,8 +793,10 @@ static inline struct kmem_cache *__find_general_cachep(size_t size, | |||
793 | * has cs_{dma,}cachep==NULL. Thus no special case | 793 | * has cs_{dma,}cachep==NULL. Thus no special case |
794 | * for large kmalloc calls required. | 794 | * for large kmalloc calls required. |
795 | */ | 795 | */ |
796 | #ifdef CONFIG_ZONE_DMA | ||
796 | if (unlikely(gfpflags & GFP_DMA)) | 797 | if (unlikely(gfpflags & GFP_DMA)) |
797 | return csizep->cs_dmacachep; | 798 | return csizep->cs_dmacachep; |
799 | #endif | ||
798 | return csizep->cs_cachep; | 800 | return csizep->cs_cachep; |
799 | } | 801 | } |
800 | 802 | ||
@@ -1493,13 +1495,15 @@ void __init kmem_cache_init(void) | |||
1493 | ARCH_KMALLOC_FLAGS|SLAB_PANIC, | 1495 | ARCH_KMALLOC_FLAGS|SLAB_PANIC, |
1494 | NULL, NULL); | 1496 | NULL, NULL); |
1495 | } | 1497 | } |
1496 | 1498 | #ifdef CONFIG_ZONE_DMA | |
1497 | sizes->cs_dmacachep = kmem_cache_create(names->name_dma, | 1499 | sizes->cs_dmacachep = kmem_cache_create( |
1500 | names->name_dma, | ||
1498 | sizes->cs_size, | 1501 | sizes->cs_size, |
1499 | ARCH_KMALLOC_MINALIGN, | 1502 | ARCH_KMALLOC_MINALIGN, |
1500 | ARCH_KMALLOC_FLAGS|SLAB_CACHE_DMA| | 1503 | ARCH_KMALLOC_FLAGS|SLAB_CACHE_DMA| |
1501 | SLAB_PANIC, | 1504 | SLAB_PANIC, |
1502 | NULL, NULL); | 1505 | NULL, NULL); |
1506 | #endif | ||
1503 | sizes++; | 1507 | sizes++; |
1504 | names++; | 1508 | names++; |
1505 | } | 1509 | } |
@@ -2321,7 +2325,7 @@ kmem_cache_create (const char *name, size_t size, size_t align, | |||
2321 | cachep->slab_size = slab_size; | 2325 | cachep->slab_size = slab_size; |
2322 | cachep->flags = flags; | 2326 | cachep->flags = flags; |
2323 | cachep->gfpflags = 0; | 2327 | cachep->gfpflags = 0; |
2324 | if (flags & SLAB_CACHE_DMA) | 2328 | if (CONFIG_ZONE_DMA_FLAG && (flags & SLAB_CACHE_DMA)) |
2325 | cachep->gfpflags |= GFP_DMA; | 2329 | cachep->gfpflags |= GFP_DMA; |
2326 | cachep->buffer_size = size; | 2330 | cachep->buffer_size = size; |
2327 | cachep->reciprocal_buffer_size = reciprocal_value(size); | 2331 | cachep->reciprocal_buffer_size = reciprocal_value(size); |
@@ -2643,10 +2647,12 @@ static void cache_init_objs(struct kmem_cache *cachep, | |||
2643 | 2647 | ||
2644 | static void kmem_flagcheck(struct kmem_cache *cachep, gfp_t flags) | 2648 | static void kmem_flagcheck(struct kmem_cache *cachep, gfp_t flags) |
2645 | { | 2649 | { |
2646 | if (flags & GFP_DMA) | 2650 | if (CONFIG_ZONE_DMA_FLAG) { |
2647 | BUG_ON(!(cachep->gfpflags & GFP_DMA)); | 2651 | if (flags & GFP_DMA) |
2648 | else | 2652 | BUG_ON(!(cachep->gfpflags & GFP_DMA)); |
2649 | BUG_ON(cachep->gfpflags & GFP_DMA); | 2653 | else |
2654 | BUG_ON(cachep->gfpflags & GFP_DMA); | ||
2655 | } | ||
2650 | } | 2656 | } |
2651 | 2657 | ||
2652 | static void *slab_get_obj(struct kmem_cache *cachep, struct slab *slabp, | 2658 | static void *slab_get_obj(struct kmem_cache *cachep, struct slab *slabp, |
diff --git a/mm/vmstat.c b/mm/vmstat.c index 5ffa8c27ead8..6c488d6ac425 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c | |||
@@ -408,6 +408,12 @@ const struct seq_operations fragmentation_op = { | |||
408 | .show = frag_show, | 408 | .show = frag_show, |
409 | }; | 409 | }; |
410 | 410 | ||
411 | #ifdef CONFIG_ZONE_DMA | ||
412 | #define TEXT_FOR_DMA(xx) xx "_dma", | ||
413 | #else | ||
414 | #define TEXT_FOR_DMA(xx) | ||
415 | #endif | ||
416 | |||
411 | #ifdef CONFIG_ZONE_DMA32 | 417 | #ifdef CONFIG_ZONE_DMA32 |
412 | #define TEXT_FOR_DMA32(xx) xx "_dma32", | 418 | #define TEXT_FOR_DMA32(xx) xx "_dma32", |
413 | #else | 419 | #else |
@@ -420,7 +426,7 @@ const struct seq_operations fragmentation_op = { | |||
420 | #define TEXT_FOR_HIGHMEM(xx) | 426 | #define TEXT_FOR_HIGHMEM(xx) |
421 | #endif | 427 | #endif |
422 | 428 | ||
423 | #define TEXTS_FOR_ZONES(xx) xx "_dma", TEXT_FOR_DMA32(xx) xx "_normal", \ | 429 | #define TEXTS_FOR_ZONES(xx) TEXT_FOR_DMA(xx) TEXT_FOR_DMA32(xx) xx "_normal", \ |
424 | TEXT_FOR_HIGHMEM(xx) | 430 | TEXT_FOR_HIGHMEM(xx) |
425 | 431 | ||
426 | static const char * const vmstat_text[] = { | 432 | static const char * const vmstat_text[] = { |