Skip to content

Commit a3ba074

Browse files
rientjestorvalds
authored andcommitted
mm/slab.c: only set __GFP_RECLAIMABLE once
SLAB_RECLAIM_ACCOUNT is a permanent attribute of a slab cache. Set __GFP_RECLAIMABLE as part of its ->allocflags rather than check the cachep flag on every page allocation. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: David Rientjes <[email protected]> Acked-by: Vlastimil Babka <[email protected]> Acked-by: Mel Gorman <[email protected]> Cc: Christoph Lameter <[email protected]> Cc: Pekka Enberg <[email protected]> Cc: Joonsoo Kim <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 9f88fae commit a3ba074

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mm/slab.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1410,8 +1410,6 @@ static struct page *kmem_getpages(struct kmem_cache *cachep, gfp_t flags,
14101410
int nr_pages;
14111411

14121412
flags |= cachep->allocflags;
1413-
if (cachep->flags & SLAB_RECLAIM_ACCOUNT)
1414-
flags |= __GFP_RECLAIMABLE;
14151413

14161414
page = __alloc_pages_node(nodeid, flags | __GFP_NOTRACK, cachep->gfporder);
14171415
if (!page) {
@@ -2144,6 +2142,8 @@ __kmem_cache_create (struct kmem_cache *cachep, unsigned long flags)
21442142
cachep->allocflags = __GFP_COMP;
21452143
if (flags & SLAB_CACHE_DMA)
21462144
cachep->allocflags |= GFP_DMA;
2145+
if (flags & SLAB_RECLAIM_ACCOUNT)
2146+
cachep->allocflags |= __GFP_RECLAIMABLE;
21472147
cachep->size = size;
21482148
cachep->reciprocal_buffer_size = reciprocal_value(size);
21492149

0 commit comments

Comments
 (0)