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 1E42FE77188 for ; Fri, 3 Jan 2025 10:32:55 +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-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=XbbPGIxwvcA4ZAyZsg9cPiM2ftS5cnR/1DaFIE7U5ro=; b=p30KgnId8Ic0+V E8BKfpPy1gzz/cTIrMaXKP1bEjthb6qxZtaMk1U6/oVA6aJba1wB6TFrjOYIKKr4/D3cm/DWstJnH 45Wj2pSXNIecylW13NtAn0FnPxS3lHBkkCUTWGi3FbeVwQ93WX+GrN2jmhoDuzSFUH30yji9KUT6E 7gWb9dSsN1eqJ0x+nF1SaxDS1hS0ClmIe9A+JGBWFJyQFJDzjWsBONQNy58CN4zUkmi+ksC/KO+qv q1OfeFcRrt2RalYuMvlcQYbmsl3QO6PtFPoc99woW3euG9yvVvIisRyyox1PIDbaw9hrGRxB0AwWg CDvwbg4c9F6maZxZq86w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tTez2-0000000Cjc8-2hmR; Fri, 03 Jan 2025 10:32:48 +0000 Received: from relay6-d.mail.gandi.net ([217.70.183.198]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tTexo-0000000CjTv-2WTh; Fri, 03 Jan 2025 10:31:34 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id 3A9C3C0007; Fri, 3 Jan 2025 10:31:20 +0000 (UTC) Message-ID: <2aed338a-97a4-40e3-8a95-99458756ca28@ghiti.fr> Date: Fri, 3 Jan 2025 11:31:19 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 05/10] riscv: mm: Skip pgtable level check in {pud,p4d}_alloc_one To: Kevin Brodsky , linux-mm@kvack.org Cc: Andrew Morton , Catalin Marinas , Dave Hansen , Linus Walleij , Andy Lutomirski , Peter Zijlstra , "Mike Rapoport (IBM)" , Ryan Roberts , Thomas Gleixner , Will Deacon , Matthew Wilcox , linux-alpha@vger.kernel.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linux-parisc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-snps-arc@lists.infradead.org, linux-um@lists.infradead.org, loongarch@lists.linux.dev, x86@kernel.org References: <20241219164425.2277022-1-kevin.brodsky@arm.com> <20241219164425.2277022-6-kevin.brodsky@arm.com> Content-Language: en-US From: Alexandre Ghiti In-Reply-To: <20241219164425.2277022-6-kevin.brodsky@arm.com> X-GND-Sasl: alex@ghiti.fr X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250103_023132_776625_3A280214 X-CRM114-Status: GOOD ( 17.21 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Hi Kevin, On 19/12/2024 17:44, Kevin Brodsky wrote: > {pmd,pud,p4d}_alloc_one() is never called if the corresponding page > table level is folded, as {pmd,pud,p4d}_alloc() already does the > required check. We can therefore remove the runtime page table level > checks in {pud,p4d}_alloc_one. The PUD helper becomes equivalent to > the generic version, so we remove it altogether. > > This is consistent with the way arm64 and x86 handle this situation > (runtime check in p4d_free() only). > > Signed-off-by: Kevin Brodsky > --- > arch/riscv/include/asm/pgalloc.h | 22 ++++------------------ > 1 file changed, 4 insertions(+), 18 deletions(-) > > diff --git a/arch/riscv/include/asm/pgalloc.h b/arch/riscv/include/asm/pgalloc.h > index f52264304f77..8ad0bbe838a2 100644 > --- a/arch/riscv/include/asm/pgalloc.h > +++ b/arch/riscv/include/asm/pgalloc.h > @@ -12,7 +12,6 @@ > #include > > #ifdef CONFIG_MMU > -#define __HAVE_ARCH_PUD_ALLOC_ONE > #define __HAVE_ARCH_PUD_FREE > #include > > @@ -88,15 +87,6 @@ static inline void pgd_populate_safe(struct mm_struct *mm, pgd_t *pgd, > } > } > > -#define pud_alloc_one pud_alloc_one > -static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long addr) > -{ > - if (pgtable_l4_enabled) > - return __pud_alloc_one(mm, addr); > - > - return NULL; > -} > - > #define pud_free pud_free > static inline void pud_free(struct mm_struct *mm, pud_t *pud) > { > @@ -118,15 +108,11 @@ static inline void __pud_free_tlb(struct mmu_gather *tlb, pud_t *pud, > #define p4d_alloc_one p4d_alloc_one > static inline p4d_t *p4d_alloc_one(struct mm_struct *mm, unsigned long addr) > { > - if (pgtable_l5_enabled) { > - gfp_t gfp = GFP_PGTABLE_USER; > - > - if (mm == &init_mm) > - gfp = GFP_PGTABLE_KERNEL; > - return (p4d_t *)get_zeroed_page(gfp); > - } > + gfp_t gfp = GFP_PGTABLE_USER; > > - return NULL; > + if (mm == &init_mm) > + gfp = GFP_PGTABLE_KERNEL; > + return (p4d_t *)get_zeroed_page(gfp); > } > > static inline void __p4d_free(struct mm_struct *mm, p4d_t *p4d) Reviewed-by: Alexandre Ghiti Thanks, Alex _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv