aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/slab.h1
-rw-r--r--mm/slab.c17
-rw-r--r--mm/slub.c10
3 files changed, 4 insertions, 24 deletions
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 1ffe0a959cd4..71829efc40ba 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -34,7 +34,6 @@ typedef struct kmem_cache kmem_cache_t __deprecated;
34 34
35/* Flags passed to a constructor functions */ 35/* Flags passed to a constructor functions */
36#define SLAB_CTOR_CONSTRUCTOR 0x001UL /* If not set, then deconstructor */ 36#define SLAB_CTOR_CONSTRUCTOR 0x001UL /* If not set, then deconstructor */
37#define SLAB_CTOR_ATOMIC 0x002UL /* Tell constructor it can't sleep */
38 37
39/* 38/*
40 * struct kmem_cache related prototypes 39 * struct kmem_cache related prototypes
diff --git a/mm/slab.c b/mm/slab.c
index a877d6f3d687..52ecf7599a7b 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -2752,13 +2752,6 @@ static int cache_grow(struct kmem_cache *cachep,
2752 2752
2753 ctor_flags = SLAB_CTOR_CONSTRUCTOR; 2753 ctor_flags = SLAB_CTOR_CONSTRUCTOR;
2754 local_flags = (flags & GFP_LEVEL_MASK); 2754 local_flags = (flags & GFP_LEVEL_MASK);
2755 if (!(local_flags & __GFP_WAIT))
2756 /*
2757 * Not allowed to sleep. Need to tell a constructor about
2758 * this - it might need to know...
2759 */
2760 ctor_flags |= SLAB_CTOR_ATOMIC;
2761
2762 /* Take the l3 list lock to change the colour_next on this node */ 2755 /* Take the l3 list lock to change the colour_next on this node */
2763 check_irq_off(); 2756 check_irq_off();
2764 l3 = cachep->nodelists[nodeid]; 2757 l3 = cachep->nodelists[nodeid];
@@ -3092,14 +3085,8 @@ static void *cache_alloc_debugcheck_after(struct kmem_cache *cachep,
3092 } 3085 }
3093#endif 3086#endif
3094 objp += obj_offset(cachep); 3087 objp += obj_offset(cachep);
3095 if (cachep->ctor && cachep->flags & SLAB_POISON) { 3088 if (cachep->ctor && cachep->flags & SLAB_POISON)
3096 unsigned long ctor_flags = SLAB_CTOR_CONSTRUCTOR; 3089 cachep->ctor(objp, cachep, SLAB_CTOR_CONSTRUCTOR);
3097
3098 if (!(flags & __GFP_WAIT))
3099 ctor_flags |= SLAB_CTOR_ATOMIC;
3100
3101 cachep->ctor(objp, cachep, ctor_flags);
3102 }
3103#if ARCH_SLAB_MINALIGN 3090#if ARCH_SLAB_MINALIGN
3104 if ((u32)objp & (ARCH_SLAB_MINALIGN-1)) { 3091 if ((u32)objp & (ARCH_SLAB_MINALIGN-1)) {
3105 printk(KERN_ERR "0x%p: not aligned to ARCH_SLAB_MINALIGN=%d\n", 3092 printk(KERN_ERR "0x%p: not aligned to ARCH_SLAB_MINALIGN=%d\n",
diff --git a/mm/slub.c b/mm/slub.c
index bd86182e595e..347e44821bcb 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -802,14 +802,8 @@ static void setup_object(struct kmem_cache *s, struct page *page,
802 init_tracking(s, object); 802 init_tracking(s, object);
803 } 803 }
804 804
805 if (unlikely(s->ctor)) { 805 if (unlikely(s->ctor))
806 int mode = SLAB_CTOR_CONSTRUCTOR; 806 s->ctor(object, s, SLAB_CTOR_CONSTRUCTOR);
807
808 if (!(s->flags & __GFP_WAIT))
809 mode |= SLAB_CTOR_ATOMIC;
810
811 s->ctor(object, s, mode);
812 }
813} 807}
814 808
815static struct page *new_slab(struct kmem_cache *s, gfp_t flags, int node) 809static struct page *new_slab(struct kmem_cache *s, gfp_t flags, int node)