From: David Rientjes Date: Thu, 16 Nov 2017 01:32:14 +0000 (-0800) Subject: mm/slab.c: only set __GFP_RECLAIMABLE once X-Git-Tag: v4.19~2177^2~114 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a3ba074447824625d3a267a5fffd2ea21556ebf4;p=platform%2Fkernel%2Flinux-rpi.git 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/alpine.DEB.2.10.1710171527560.140898@chino.kir.corp.google.com Signed-off-by: David Rientjes Acked-by: Vlastimil Babka Acked-by: Mel Gorman Cc: Christoph Lameter Cc: Pekka Enberg Cc: Joonsoo Kim Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/slab.c b/mm/slab.c index 1a6797e..0c6468c07 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -1410,8 +1410,6 @@ static struct page *kmem_getpages(struct kmem_cache *cachep, gfp_t flags, int nr_pages; flags |= cachep->allocflags; - if (cachep->flags & SLAB_RECLAIM_ACCOUNT) - flags |= __GFP_RECLAIMABLE; page = __alloc_pages_node(nodeid, flags | __GFP_NOTRACK, cachep->gfporder); if (!page) { @@ -2144,6 +2142,8 @@ done: cachep->allocflags = __GFP_COMP; if (flags & SLAB_CACHE_DMA) cachep->allocflags |= GFP_DMA; + if (flags & SLAB_RECLAIM_ACCOUNT) + cachep->allocflags |= __GFP_RECLAIMABLE; cachep->size = size; cachep->reciprocal_buffer_size = reciprocal_value(size);