aboutsummaryrefslogtreecommitdiffstats
path: root/mm/slab.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/slab.c')
-rw-r--r--mm/slab.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/mm/slab.c b/mm/slab.c
index caa8f87e04eb..348396d691a1 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -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
2644static void kmem_flagcheck(struct kmem_cache *cachep, gfp_t flags) 2648static 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
2652static void *slab_get_obj(struct kmem_cache *cachep, struct slab *slabp, 2658static void *slab_get_obj(struct kmem_cache *cachep, struct slab *slabp,