From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B91DAC4167B for ; Thu, 14 Dec 2023 16:03:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ClbE98uVtCvKvoEkfPUc0U7Zb8my4q4q3oFDSZlkjBs=; b=e8NsWJbsGR9rn5 YC0gPgu2o4kpC3hLpkby7cP1mX0mBhOXVMbBnTl432dPF09zc9if+L1LT8PXVTLVJUMIa98i2TpUB 7bamjQXt2EBw26ucSrBiFvqZefnsskmZ5e1G1Iji7+9YaL/qaNVGzUkHXjoYtsOHtCYkBPwnXpA2O dOo5lDhO5XF3N4gh6wsRqjUqzDwXho1W8ngFW1b+kfwcVIenv1ZlbIKBkOZB+9Cv0ah82RYG/5Bjk rhNI4sbCCrfbLG4JJtMTdAoZmAo98Ms7mOEyT53/FPnOSynYj5ZJ0WQztXXjJepvqKHsIKnmg3ciL 6DUHlR6qJUyetiteXK7Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rDoB6-000kSX-1I; Thu, 14 Dec 2023 16:03:12 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rDoB2-000kRh-2a for linux-arm-kernel@lists.infradead.org; Thu, 14 Dec 2023 16:03:10 +0000 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231214_080309_030247_2824C110 X-CRM114-Status: GOOD ( 10.66 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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-unstable? 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 = vmf->vma; unsigned long orders; struct folio *folio; @@ -4199,12 +4199,9 @@ static struct folio *alloc_anon_folio(struct vm_fault *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 = alloc_anon_folio(vmf); if (IS_ERR(folio)) return 0; -- 2.25.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel