From patchwork Mon Nov 25 21:01:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthew Wilcox (Oracle)" X-Patchwork-Id: 13885268 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26E40D59D72 for ; Mon, 25 Nov 2024 21:02:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B36606B0095; Mon, 25 Nov 2024 16:01:55 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 90D476B0099; Mon, 25 Nov 2024 16:01:55 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 558046B0089; Mon, 25 Nov 2024 16:01:55 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 0CCF56B0088 for ; Mon, 25 Nov 2024 16:01:55 -0500 (EST) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 84AAA140DE0 for ; Mon, 25 Nov 2024 21:01:54 +0000 (UTC) X-FDA: 82825839222.24.EFEBF03 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf29.hostedemail.com (Postfix) with ESMTP id 6394B120016 for ; Mon, 25 Nov 2024 21:01:47 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=Orix3nIu; spf=none (imf29.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1732568511; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=d0Iig2e7urKkwRSj05cFTUrQfZB5n5HhbU15XNoSt6A=; b=6CdAzwQY7ptn4ADJv8ng3E1SRqUm1S2YEAeVndWTJjEsO+0kZ9YkcvZ4z7jzyz3Ixcnzbb JGz4MAw3VljXkdy/mlmWzZh6P0Mn3heGkT40asgyC3IKOtJXgZwcd7T7y+wRZko54hYPFF nVA/e4D5z2wxWnV32o/aOgyn9CN+tvs= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1732568511; a=rsa-sha256; cv=none; b=47M06GBC1f06ITZa8NyLkCEqeFdekil93sr1/vArWKTntkW17IqTeGX89H6M30R27T+dKU /5FzL/Lj8cAf0VHUciaigaErBj0IWxHioQLBcPSkE8ybi6OVrl/Oi8xah/14M/G7iJz2/4 mrsj5w5FOj4DF9fqFSdveC/mq4eclms= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=Orix3nIu; spf=none (imf29.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=d0Iig2e7urKkwRSj05cFTUrQfZB5n5HhbU15XNoSt6A=; b=Orix3nIuwzh7iHRJ/G3ctdHXU2 PBguElb0sS+lB3RITAuEQx0GRtZLwdQRd29ty0yu99PEl8UgK41O6bsxNiYq2xpuVVabH1+nPj+tD 0s74XzkNgMQCZCDr1mEtuzs8Nru/pbHNK/u4Yg/nZZgcqWcul3u3QRmsAtUxntglTLSH4pd22ITkj hb0zS/AZVxD0g9NcFQf1heLs75aGfZ0UnGuWzWIbghWYY7o39kBofKnnquh1OyWq7Vht+1dCWbP4/ H15escYHFF9tViGxcOT4nINNhjZ5cZoHTyIlQZGYyMvNcpSS7fhocZkm2nfn2ZzPfFgyYgrZ/60jx Njbg9E4w==; Received: from willy by casper.infradead.org with local (Exim 4.98 #2 (Red Hat Linux)) id 1tFgDP-0000000CUE5-22dg; Mon, 25 Nov 2024 21:01:51 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, David Hildenbrand Subject: [PATCH v3 07/15] mm/page_alloc: Move set_page_refcounted() to callers of __alloc_pages_cpuset_fallback() Date: Mon, 25 Nov 2024 21:01:39 +0000 Message-ID: <20241125210149.2976098-8-willy@infradead.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241125210149.2976098-1-willy@infradead.org> References: <20241125210149.2976098-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Server: rspam10 X-Stat-Signature: gt5kaycurmiormbecdcbjjmhbqrmt7fi X-Rspamd-Queue-Id: 6394B120016 X-Rspam-User: X-HE-Tag: 1732568507-329011 X-HE-Meta: U2FsdGVkX18mt9b4geHJLQsViVP7i6dVtuX/ZQW31v9if8hM1KlykE3o1ejwSMmcmkuDUrJp0mwk2Xor7IBc9wbZ9M9oLOKpoh+FCzwKDXYB0783eEV+5RdANacLfMecytiea52CWsajtnf4VDAhsXvucb+1ZaHtpeiDl3oEhGJqic3AtsJ845bfqxIzbwD6/mmv4W+P3EsGrIXCw1r/LFS0IERECiwdmyZqHTXbF9z35EjGf/obKGeSBSFIqHChvALbeB4k3XD1cy3ZPAd4nwyU5dCabo21Yuw7VUN2aD6jakStMJSK5+cFFSjUDBkQ/p1qxkyaD2QL8mo8mhcyTz/cLe1YMBz2B36C+remDdTsypCWr5zukmDzXL/DRv3RQ3PV/fuMXPnwnDXDowoRUOcqXHWfvfpzuGwqnigM+7GKISMZoUZJjMQPHTTgapPj4/lAZ+tHLTEDA8RDVaIOcO4t3v43cgbKkHmhO96qiTeHa1foKN7PTt2fOfR6R0tZ1n9eNtcPjSXANWba1ok/aR58f1mVBMpzSDqZJ1j11Wfqh9oi/1uYlTN5Yaoq7ej0vvSRB8z9kTw+DSxCUOAc7lOAVFKpHDYKEmDMxXOciiOjRd/lXq95M+1nlAABX/sdDiktfLVucNd5DBB/atYEgkgxeUGK0Pk8CXjkK4zaKPT0C27DE4IlyCltsu5RZhZ44xDpqUG8hpivccjIaiG8uEGvR6iqtQyE/dHkyYAGiDfGCFAYLILShpfb5WalQgAfS98xK7NdtoM6/u/tmxUgmD5E4LqEJw7zJns5WS/vw8117aYXzdPuEsV6JsXypDAXgqWIA4EwnLCg3R4EEFzNdqG0UJW3+0V6ftRUpC4TKld3rHFULdCLfL6PZDmczuCt15AbNvpGzvyXmqFNIBOSVLFT2G495cKpN61mJOiLcC273L6rmbB5AcTTBK6hFAhUX22koYSsHsji1S9Nuni 88KB8s7O J8x/EUJeSh1O9EZmra9KVkWo1SilPGlkV3QMER2aHD6IO777bE6JVyFGIGcwjFHeA/5gV0SuUfO/bE1YY9YB/wLFcUIqPBAk1j2/lxYVArYrwIFhTsPznQ649CGEE3Qp0Sy9TgOjjQKtCW44XYfuXZZbKlV1kS6o1MTWIGWKh2+baThcrFOOFC8+e34jl5XcMMCLV726g381rPqaHruxXX0pYl3um73NArUA612QIJSKjc8dxMpPE7igHOc1ZIM8PM8q6XTvfRALuVDYosrBH7ZZhroWrph7jZSCR X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: In preparation for allocating frozen pages, stop initialising the page refcount in __alloc_pages_cpuset_fallback(). Signed-off-by: Matthew Wilcox (Oracle) --- mm/page_alloc.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 14fa6bf7578a..c9e5c69f0cb9 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -3600,9 +3600,6 @@ __alloc_pages_cpuset_fallback(gfp_t gfp_mask, unsigned int order, if (!page) page = get_page_from_freelist(gfp_mask, order, alloc_flags, ac); - - if (page) - set_page_refcounted(page); return page; } @@ -3689,6 +3686,8 @@ __alloc_pages_may_oom(gfp_t gfp_mask, unsigned int order, if (gfp_mask & __GFP_NOFAIL) page = __alloc_pages_cpuset_fallback(gfp_mask, order, ALLOC_NO_WATERMARKS, ac); + if (page) + set_page_refcounted(page); } out: mutex_unlock(&oom_lock); @@ -4517,8 +4516,10 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order, * the situation worse. */ page = __alloc_pages_cpuset_fallback(gfp_mask, order, ALLOC_MIN_RESERVE, ac); - if (page) + if (page) { + set_page_refcounted(page); goto got_pg; + } cond_resched(); goto retry;