From nobody Sat Dec 27 22:50:34 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B9DCC4332F for ; Thu, 14 Dec 2023 16:03:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443717AbjLNQDB (ORCPT ); Thu, 14 Dec 2023 11:03:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230430AbjLNQC7 (ORCPT ); Thu, 14 Dec 2023 11:02:59 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 72A5811A for ; Thu, 14 Dec 2023 08:03:06 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9E6D2C15; Thu, 14 Dec 2023 08:03:51 -0800 (PST) Received: from e125769.cambridge.arm.com (e125769.cambridge.arm.com [10.1.196.26]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2B66C3F5A1; Thu, 14 Dec 2023 08:03:03 -0800 (PST) From: Ryan Roberts To: Andrew Morton , Matthew Wilcox , Yin Fengwei , David Hildenbrand , Yu Zhao , Catalin Marinas , Anshuman Khandual , Yang Shi , "Huang, Ying" , Zi Yan , Luis Chamberlain , Itaru Kitayama , "Kirill A. Shutemov" , John Hubbard , David Rientjes , Vlastimil Babka , Hugh Dickins , Kefeng Wang , Barry Song <21cnbao@gmail.com>, Alistair Popple , Dan Carpenter Cc: Ryan Roberts , linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] mm: Resolve some multi-size THP review nits Date: Thu, 14 Dec 2023 16:02:51 +0000 Message-Id: <20231214160251.3574571-1-ryan.roberts@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Tidy code based on review feedback for final version of multi-size THP: - Comment added to explain alloc_anon_folio() error protocol - ifdefery simplified for alloc_anon_folio() Signed-off-by: Ryan Roberts --- Hi Andrew, Hopefully this is the final tweak. Could you please squash this with the "mm: thp: Support allocation of anonymous multi-size THP" patch in mm-unsta= ble? Or if you prefer me to re-post the entire series, just let me know. Thanks, Ryan mm/memory.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/mm/memory.c b/mm/memory.c index 8f0b936b90b5..3c530b639559 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -4137,9 +4137,9 @@ static bool pte_range_none(pte_t *pte, int nr_pages) return true; } -#ifdef CONFIG_TRANSPARENT_HUGEPAGE static struct folio *alloc_anon_folio(struct vm_fault *vmf) { +#ifdef CONFIG_TRANSPARENT_HUGEPAGE struct vm_area_struct *vma =3D vmf->vma; unsigned long orders; struct folio *folio; @@ -4199,12 +4199,9 @@ static struct folio *alloc_anon_folio(struct vm_faul= t *vmf) } fallback: - return vma_alloc_zeroed_movable_folio(vma, vmf->address); -} -#else -#define alloc_anon_folio(vmf) \ - vma_alloc_zeroed_movable_folio((vmf)->vma, (vmf)->address) #endif + return vma_alloc_zeroed_movable_folio(vmf->vma, vmf->address); +} /* * We enter with non-exclusive mmap_lock (to exclude vma changes, @@ -4260,6 +4257,7 @@ static vm_fault_t do_anonymous_page(struct vm_fault *= vmf) /* Allocate our own private page. */ if (unlikely(anon_vma_prepare(vma))) goto oom; + /* Returns NULL on OOM or ERR_PTR(-EAGAIN) if we must retry the fault */ folio =3D alloc_anon_folio(vmf); if (IS_ERR(folio)) return 0; -- 2.25.1