diff options
Diffstat (limited to 'mm/slub.c')
-rw-r--r-- | mm/slub.c | 30 |
1 files changed, 13 insertions, 17 deletions
@@ -980,7 +980,7 @@ __setup("slub_debug", setup_slub_debug); | |||
980 | 980 | ||
981 | static unsigned long kmem_cache_flags(unsigned long objsize, | 981 | static unsigned long kmem_cache_flags(unsigned long objsize, |
982 | unsigned long flags, const char *name, | 982 | unsigned long flags, const char *name, |
983 | void (*ctor)(void *, struct kmem_cache *, unsigned long)) | 983 | void (*ctor)(struct kmem_cache *, void *)) |
984 | { | 984 | { |
985 | /* | 985 | /* |
986 | * The page->offset field is only 16 bit wide. This is an offset | 986 | * The page->offset field is only 16 bit wide. This is an offset |
@@ -1027,7 +1027,7 @@ static inline int check_object(struct kmem_cache *s, struct page *page, | |||
1027 | static inline void add_full(struct kmem_cache_node *n, struct page *page) {} | 1027 | static inline void add_full(struct kmem_cache_node *n, struct page *page) {} |
1028 | static inline unsigned long kmem_cache_flags(unsigned long objsize, | 1028 | static inline unsigned long kmem_cache_flags(unsigned long objsize, |
1029 | unsigned long flags, const char *name, | 1029 | unsigned long flags, const char *name, |
1030 | void (*ctor)(void *, struct kmem_cache *, unsigned long)) | 1030 | void (*ctor)(struct kmem_cache *, void *)) |
1031 | { | 1031 | { |
1032 | return flags; | 1032 | return flags; |
1033 | } | 1033 | } |
@@ -1071,7 +1071,7 @@ static void setup_object(struct kmem_cache *s, struct page *page, | |||
1071 | { | 1071 | { |
1072 | setup_object_debug(s, page, object); | 1072 | setup_object_debug(s, page, object); |
1073 | if (unlikely(s->ctor)) | 1073 | if (unlikely(s->ctor)) |
1074 | s->ctor(object, s, 0); | 1074 | s->ctor(s, object); |
1075 | } | 1075 | } |
1076 | 1076 | ||
1077 | static struct page *new_slab(struct kmem_cache *s, gfp_t flags, int node) | 1077 | static struct page *new_slab(struct kmem_cache *s, gfp_t flags, int node) |
@@ -1085,9 +1085,6 @@ static struct page *new_slab(struct kmem_cache *s, gfp_t flags, int node) | |||
1085 | 1085 | ||
1086 | BUG_ON(flags & GFP_SLAB_BUG_MASK); | 1086 | BUG_ON(flags & GFP_SLAB_BUG_MASK); |
1087 | 1087 | ||
1088 | if (flags & __GFP_WAIT) | ||
1089 | local_irq_enable(); | ||
1090 | |||
1091 | page = allocate_slab(s, | 1088 | page = allocate_slab(s, |
1092 | flags & (GFP_RECLAIM_MASK | GFP_CONSTRAINT_MASK), node); | 1089 | flags & (GFP_RECLAIM_MASK | GFP_CONSTRAINT_MASK), node); |
1093 | if (!page) | 1090 | if (!page) |
@@ -1120,8 +1117,6 @@ static struct page *new_slab(struct kmem_cache *s, gfp_t flags, int node) | |||
1120 | page->freelist = start; | 1117 | page->freelist = start; |
1121 | page->inuse = 0; | 1118 | page->inuse = 0; |
1122 | out: | 1119 | out: |
1123 | if (flags & __GFP_WAIT) | ||
1124 | local_irq_disable(); | ||
1125 | return page; | 1120 | return page; |
1126 | } | 1121 | } |
1127 | 1122 | ||
@@ -1505,7 +1500,14 @@ new_slab: | |||
1505 | goto load_freelist; | 1500 | goto load_freelist; |
1506 | } | 1501 | } |
1507 | 1502 | ||
1503 | if (gfpflags & __GFP_WAIT) | ||
1504 | local_irq_enable(); | ||
1505 | |||
1508 | new = new_slab(s, gfpflags, node); | 1506 | new = new_slab(s, gfpflags, node); |
1507 | |||
1508 | if (gfpflags & __GFP_WAIT) | ||
1509 | local_irq_disable(); | ||
1510 | |||
1509 | if (new) { | 1511 | if (new) { |
1510 | c = get_cpu_slab(s, smp_processor_id()); | 1512 | c = get_cpu_slab(s, smp_processor_id()); |
1511 | if (c->page) { | 1513 | if (c->page) { |
@@ -2039,12 +2041,6 @@ static struct kmem_cache_node *early_kmem_cache_node_alloc(gfp_t gfpflags, | |||
2039 | init_kmem_cache_node(n); | 2041 | init_kmem_cache_node(n); |
2040 | atomic_long_inc(&n->nr_slabs); | 2042 | atomic_long_inc(&n->nr_slabs); |
2041 | add_partial(n, page); | 2043 | add_partial(n, page); |
2042 | |||
2043 | /* | ||
2044 | * new_slab() disables interupts. If we do not reenable interrupts here | ||
2045 | * then bootup would continue with interrupts disabled. | ||
2046 | */ | ||
2047 | local_irq_enable(); | ||
2048 | return n; | 2044 | return n; |
2049 | } | 2045 | } |
2050 | 2046 | ||
@@ -2215,7 +2211,7 @@ static int calculate_sizes(struct kmem_cache *s) | |||
2215 | static int kmem_cache_open(struct kmem_cache *s, gfp_t gfpflags, | 2211 | static int kmem_cache_open(struct kmem_cache *s, gfp_t gfpflags, |
2216 | const char *name, size_t size, | 2212 | const char *name, size_t size, |
2217 | size_t align, unsigned long flags, | 2213 | size_t align, unsigned long flags, |
2218 | void (*ctor)(void *, struct kmem_cache *, unsigned long)) | 2214 | void (*ctor)(struct kmem_cache *, void *)) |
2219 | { | 2215 | { |
2220 | memset(s, 0, kmem_size); | 2216 | memset(s, 0, kmem_size); |
2221 | s->name = name; | 2217 | s->name = name; |
@@ -2805,7 +2801,7 @@ static int slab_unmergeable(struct kmem_cache *s) | |||
2805 | 2801 | ||
2806 | static struct kmem_cache *find_mergeable(size_t size, | 2802 | static struct kmem_cache *find_mergeable(size_t size, |
2807 | size_t align, unsigned long flags, const char *name, | 2803 | size_t align, unsigned long flags, const char *name, |
2808 | void (*ctor)(void *, struct kmem_cache *, unsigned long)) | 2804 | void (*ctor)(struct kmem_cache *, void *)) |
2809 | { | 2805 | { |
2810 | struct kmem_cache *s; | 2806 | struct kmem_cache *s; |
2811 | 2807 | ||
@@ -2846,7 +2842,7 @@ static struct kmem_cache *find_mergeable(size_t size, | |||
2846 | 2842 | ||
2847 | struct kmem_cache *kmem_cache_create(const char *name, size_t size, | 2843 | struct kmem_cache *kmem_cache_create(const char *name, size_t size, |
2848 | size_t align, unsigned long flags, | 2844 | size_t align, unsigned long flags, |
2849 | void (*ctor)(void *, struct kmem_cache *, unsigned long)) | 2845 | void (*ctor)(struct kmem_cache *, void *)) |
2850 | { | 2846 | { |
2851 | struct kmem_cache *s; | 2847 | struct kmem_cache *s; |
2852 | 2848 | ||