[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>
This commit is contained in:
committed by
Linus Torvalds
parent
66701b1499
commit
4b51d66989
20
mm/slab.c
20
mm/slab.c
@@ -793,8 +793,10 @@ static inline struct kmem_cache *__find_general_cachep(size_t size,
|
||||
* has cs_{dma,}cachep==NULL. Thus no special case
|
||||
* for large kmalloc calls required.
|
||||
*/
|
||||
#ifdef CONFIG_ZONE_DMA
|
||||
if (unlikely(gfpflags & GFP_DMA))
|
||||
return csizep->cs_dmacachep;
|
||||
#endif
|
||||
return csizep->cs_cachep;
|
||||
}
|
||||
|
||||
@@ -1493,13 +1495,15 @@ void __init kmem_cache_init(void)
|
||||
ARCH_KMALLOC_FLAGS|SLAB_PANIC,
|
||||
NULL, NULL);
|
||||
}
|
||||
|
||||
sizes->cs_dmacachep = kmem_cache_create(names->name_dma,
|
||||
#ifdef CONFIG_ZONE_DMA
|
||||
sizes->cs_dmacachep = kmem_cache_create(
|
||||
names->name_dma,
|
||||
sizes->cs_size,
|
||||
ARCH_KMALLOC_MINALIGN,
|
||||
ARCH_KMALLOC_FLAGS|SLAB_CACHE_DMA|
|
||||
SLAB_PANIC,
|
||||
NULL, NULL);
|
||||
#endif
|
||||
sizes++;
|
||||
names++;
|
||||
}
|
||||
@@ -2321,7 +2325,7 @@ kmem_cache_create (const char *name, size_t size, size_t align,
|
||||
cachep->slab_size = slab_size;
|
||||
cachep->flags = flags;
|
||||
cachep->gfpflags = 0;
|
||||
if (flags & SLAB_CACHE_DMA)
|
||||
if (CONFIG_ZONE_DMA_FLAG && (flags & SLAB_CACHE_DMA))
|
||||
cachep->gfpflags |= GFP_DMA;
|
||||
cachep->buffer_size = size;
|
||||
cachep->reciprocal_buffer_size = reciprocal_value(size);
|
||||
@@ -2643,10 +2647,12 @@ static void cache_init_objs(struct kmem_cache *cachep,
|
||||
|
||||
static void kmem_flagcheck(struct kmem_cache *cachep, gfp_t flags)
|
||||
{
|
||||
if (flags & GFP_DMA)
|
||||
BUG_ON(!(cachep->gfpflags & GFP_DMA));
|
||||
else
|
||||
BUG_ON(cachep->gfpflags & GFP_DMA);
|
||||
if (CONFIG_ZONE_DMA_FLAG) {
|
||||
if (flags & GFP_DMA)
|
||||
BUG_ON(!(cachep->gfpflags & GFP_DMA));
|
||||
else
|
||||
BUG_ON(cachep->gfpflags & GFP_DMA);
|
||||
}
|
||||
}
|
||||
|
||||
static void *slab_get_obj(struct kmem_cache *cachep, struct slab *slabp,
|
||||
|
Reference in New Issue
Block a user