aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/slub_def.h1
-rw-r--r--mm/slub.c19
2 files changed, 12 insertions, 8 deletions
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index a849c472b845..98be113cf935 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -71,6 +71,7 @@ struct kmem_cache {
71 71
72 /* Allocation and freeing of slabs */ 72 /* Allocation and freeing of slabs */
73 int objects; /* Number of objects in slab */ 73 int objects; /* Number of objects in slab */
74 gfp_t allocflags; /* gfp flags to use on each alloc */
74 int refcount; /* Refcount for slab cache destroy */ 75 int refcount; /* Refcount for slab cache destroy */
75 void (*ctor)(struct kmem_cache *, void *); 76 void (*ctor)(struct kmem_cache *, void *);
76 int inuse; /* Offset to metadata */ 77 int inuse; /* Offset to metadata */
diff --git a/mm/slub.c b/mm/slub.c
index 1af7f2f19420..ccfd41141b6b 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1078,14 +1078,7 @@ static struct page *allocate_slab(struct kmem_cache *s, gfp_t flags, int node)
1078 struct page *page; 1078 struct page *page;
1079 int pages = 1 << s->order; 1079 int pages = 1 << s->order;
1080 1080
1081 if (s->order) 1081 flags |= s->allocflags;
1082 flags |= __GFP_COMP;
1083
1084 if (s->flags & SLAB_CACHE_DMA)
1085 flags |= SLUB_DMA;
1086
1087 if (s->flags & SLAB_RECLAIM_ACCOUNT)
1088 flags |= __GFP_RECLAIMABLE;
1089 1082
1090 if (node == -1) 1083 if (node == -1)
1091 page = alloc_pages(flags, s->order); 1084 page = alloc_pages(flags, s->order);
@@ -2333,6 +2326,16 @@ static int calculate_sizes(struct kmem_cache *s)
2333 if (s->order < 0) 2326 if (s->order < 0)
2334 return 0; 2327 return 0;
2335 2328
2329 s->allocflags = 0;
2330 if (s->order)
2331 s->allocflags |= __GFP_COMP;
2332
2333 if (s->flags & SLAB_CACHE_DMA)
2334 s->allocflags |= SLUB_DMA;
2335
2336 if (s->flags & SLAB_RECLAIM_ACCOUNT)
2337 s->allocflags |= __GFP_RECLAIMABLE;
2338
2336 /* 2339 /*
2337 * Determine the number of objects per slab 2340 * Determine the number of objects per slab
2338 */ 2341 */