From 29987cee1a115a24e19b1f18fae2f7e2e0862b29 Mon Sep 17 00:00:00 2001 From: "Matthew Wilcox (Oracle)" Date: Tue, 14 Jun 2022 16:27:38 -0400 Subject: [PATCH] mm/page_alloc: Move set_page_refcounted() to callers of __alloc_pages_direct_reclaim() In preparation for allocating frozen pages, stop initialising the page refcount in __alloc_pages_direct_reclaim(). Signed-off-by: Matthew Wilcox (Oracle) --- mm/page_alloc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index e5985d627b447..d31c56f95aa58 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -4789,7 +4789,6 @@ retry: drained = true; goto retry; } - set_page_refcounted(page); out: psi_memstall_leave(&pflags); @@ -5186,8 +5185,10 @@ retry: /* Try direct reclaim and then allocating */ page = __alloc_pages_direct_reclaim(gfp_mask, order, alloc_flags, ac, &did_some_progress); - if (page) + if (page) { + set_page_refcounted(page); goto got_pg; + } /* Try direct compaction and then allocating */ page = __alloc_pages_direct_compact(gfp_mask, order, alloc_flags, ac, -- 2.49.0