Skip to contentSkip to conversation

mm/slab.c: only set __GFP_RECLAIMABLE once

PATCH New [email protected] 1 participant 1 message Nov 16, 2017 Memory management

lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 17/131 mm/slab.c: only set __GFP_RECLAIMABLE once

From: David Rientjes <[email protected]>
Subject: 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.

---

 mm/slab.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
mm/slab.c renamed from mm/slab.c~mm-slab-only-set-__gfp_reclaimable-once +2 -2
diff -puN mm/slab.c~mm-slab-only-set-__gfp_reclaimable-once mm/slab.c
@@ -1410,8 +1410,6 @@ static struct page *kmem_getpages(struct
 	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);
 

_