aboutsummaryrefslogtreecommitdiffstats
path: root/mm/slab.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/slab.c')
-rw-r--r--mm/slab.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/mm/slab.c b/mm/slab.c
index d2cd304fd8af..1a88fded7f19 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -2746,7 +2746,7 @@ static int cache_grow(struct kmem_cache *cachep,
2746 * Be lazy and only check for valid flags here, keeping it out of the 2746 * Be lazy and only check for valid flags here, keeping it out of the
2747 * critical path in kmem_cache_alloc(). 2747 * critical path in kmem_cache_alloc().
2748 */ 2748 */
2749 BUG_ON(flags & ~(GFP_DMA | GFP_LEVEL_MASK)); 2749 BUG_ON(flags & ~(GFP_DMA | __GFP_ZERO | GFP_LEVEL_MASK));
2750 2750
2751 local_flags = (flags & GFP_LEVEL_MASK); 2751 local_flags = (flags & GFP_LEVEL_MASK);
2752 /* Take the l3 list lock to change the colour_next on this node */ 2752 /* Take the l3 list lock to change the colour_next on this node */
@@ -3392,6 +3392,9 @@ __cache_alloc_node(struct kmem_cache *cachep, gfp_t flags, int nodeid,
3392 local_irq_restore(save_flags); 3392 local_irq_restore(save_flags);
3393 ptr = cache_alloc_debugcheck_after(cachep, flags, ptr, caller); 3393 ptr = cache_alloc_debugcheck_after(cachep, flags, ptr, caller);
3394 3394
3395 if (unlikely((flags & __GFP_ZERO) && ptr))
3396 memset(ptr, 0, obj_size(cachep));
3397
3395 return ptr; 3398 return ptr;
3396} 3399}
3397 3400
@@ -3443,6 +3446,9 @@ __cache_alloc(struct kmem_cache *cachep, gfp_t flags, void *caller)
3443 objp = cache_alloc_debugcheck_after(cachep, flags, objp, caller); 3446 objp = cache_alloc_debugcheck_after(cachep, flags, objp, caller);
3444 prefetchw(objp); 3447 prefetchw(objp);
3445 3448
3449 if (unlikely((flags & __GFP_ZERO) && objp))
3450 memset(objp, 0, obj_size(cachep));
3451
3446 return objp; 3452 return objp;
3447} 3453}
3448 3454