[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2434dfdf-d4a0-4f81-9b65-51be86487fd2@bytedance.com>
Date: Sat, 28 Dec 2024 14:36:06 +0800
From: Qi Zheng <zhengqi.arch@...edance.com>
To: Palmer Dabbelt <palmer@...belt.com>
Cc: peterz@...radead.org, agordeev@...ux.ibm.com, kevin.brodsky@....com,
tglx@...utronix.de, david@...hat.com, jannh@...gle.com, hughd@...gle.com,
yuzhao@...gle.com, willy@...radead.org, muchun.song@...ux.dev,
vbabka@...nel.org, lorenzo.stoakes@...cle.com, akpm@...ux-foundation.org,
rientjes@...gle.com, vishal.moola@...il.com, Arnd Bergmann <arnd@...db.de>,
Will Deacon <will@...nel.org>, aneesh.kumar@...nel.org, npiggin@...il.com,
dave.hansen@...ux.intel.com, rppt@...nel.org, ryan.roberts@....com,
linux-mm@...ck.org, linux-arm-kernel@...ts.infradead.org,
linuxppc-dev@...ts.ozlabs.org, linux-riscv@...ts.infradead.org,
linux-s390@...r.kernel.org, sparclinux@...r.kernel.org,
linux-kernel@...r.kernel.org, x86@...nel.org, linux-arch@...r.kernel.org,
linux-csky@...r.kernel.org, linux-hexagon@...r.kernel.org,
loongarch@...ts.linux.dev, linux-m68k@...ts.linux-m68k.org,
linux-mips@...r.kernel.org, linux-openrisc@...r.kernel.org,
linux-sh@...r.kernel.org, linux-um@...ts.infradead.org
Subject: Re: [PATCH v3 02/17] riscv: mm: Skip pgtable level check in
{pud,p4d}_alloc_one
Hi Palmer,
On 2024/12/28 00:40, Palmer Dabbelt wrote:
> On Mon, 23 Dec 2024 01:40:48 PST (-0800), zhengqi.arch@...edance.com wrote:
>> From: Kevin Brodsky <kevin.brodsky@....com>
>>
>> {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 <kevin.brodsky@....com>
>> Acked-by: Dave Hansen <dave.hansen@...ux.intel.com>
>> Signed-off-by: Qi Zheng <zhengqi.arch@...edance.com>
>> ---
>> 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 f52264304f772..8ad0bbe838a24 100644
>> --- a/arch/riscv/include/asm/pgalloc.h
>> +++ b/arch/riscv/include/asm/pgalloc.h
>> @@ -12,7 +12,6 @@
>> #include <asm/tlb.h>
>>
>> #ifdef CONFIG_MMU
>> -#define __HAVE_ARCH_PUD_ALLOC_ONE
>> #define __HAVE_ARCH_PUD_FREE
>> #include <asm-generic/pgalloc.h>
>>
>> @@ -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)
>
> Acked-by: Palmer Dabbelt <palmer@...osinc.com>
Thank you for reviewing the patch!
>
> Are you trying to keep these together, or do you want me to try and pick
> up the RISC-V bits on their own?
I prefer to keep them together because later patches depend on this one.
And this patch series has been merged into mm-unstable branch.
Thanks!
Powered by blists - more mailing lists