The patch titled Subject: riscv: mm: Skip pgtable level check in {pud,p4d}_alloc_one has been added to the -mm mm-unstable branch. Its filename is riscv-mm-skip-pgtable-level-check-in-pudp4d_alloc_one.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/riscv-mm-skip-pgtable-level-check-in-pudp4d_alloc_one.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Kevin Brodsky <kevin.brodsky@xxxxxxx> Subject: riscv: mm: Skip pgtable level check in {pud,p4d}_alloc_one Date: Mon, 23 Dec 2024 17:40:48 +0800 {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). Link: https://lkml.kernel.org/r/84ddf857508b98a195a790bc6ff6ab8849b44633.1734945104.git.zhengqi.arch@xxxxxxxxxxxxx Signed-off-by: Kevin Brodsky <kevin.brodsky@xxxxxxx> Signed-off-by: Qi Zheng <zhengqi.arch@xxxxxxxxxxxxx> Acked-by: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx> Cc: Alexander Gordeev <agordeev@xxxxxxxxxxxxx> Cc: Aneesh Kumar K.V (Arm) <aneesh.kumar@xxxxxxxxxx> Cc: Arnd Bergmann <arnd@xxxxxxxx> Cc: David Hildenbrand <david@xxxxxxxxxx> Cc: David Rientjes <rientjes@xxxxxxxxxx> Cc: Hugh Dickins <hughd@xxxxxxxxxx> Cc: Jann Horn <jannh@xxxxxxxxxx> Cc: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx> Cc: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx> Cc: Mike Rapoport (Microsoft) <rppt@xxxxxxxxxx> Cc: Muchun Song <muchun.song@xxxxxxxxx> Cc: Nicholas Piggin <npiggin@xxxxxxxxx> Cc: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx> Cc: Ryan Roberts <ryan.roberts@xxxxxxx> Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx> Cc: Vishal Moola (Oracle) <vishal.moola@xxxxxxxxx> Cc: Will Deacon <will@xxxxxxxxxx> Cc: Yu Zhao <yuzhao@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- arch/riscv/include/asm/pgalloc.h | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) --- a/arch/riscv/include/asm/pgalloc.h~riscv-mm-skip-pgtable-level-check-in-pudp4d_alloc_one +++ a/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(str } } -#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 #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) _ Patches currently in -mm which might be from kevin.brodsky@xxxxxxx are selftests-mm-fix-condition-in-uffd_move_test_common.patch selftests-mm-fix-wmaybe-uninitialized-warnings.patch selftests-mm-fix-strncpy-length.patch selftests-mm-fix-warray-bounds-warnings-in-pkey_sighandler_tests.patch selftests-mm-fix-warray-bounds-warnings-in-pkey_sighandler_tests-fix.patch selftests-mm-build-with-o2.patch selftests-mm-remove-unused-pkey-helpers.patch selftests-mm-define-types-using-typedef-in-pkey-helpersh.patch selftests-mm-ensure-pkey-h-define-inline-functions-only.patch selftests-mm-remove-empty-pkey-helper-definition.patch selftests-mm-ensure-non-global-pkey-symbols-are-marked-static.patch selftests-mm-use-sys_pkey-helpers-consistently.patch selftests-mm-use-sys_pkey-helpers-consistently-fix.patch selftests-mm-rename-pkey-register-macro.patch selftests-mm-skip-pkey_sighandler_tests-if-support-is-missing.patch selftests-mm-remove-x-permission-from-sigaltstack-mapping.patch riscv-mm-skip-pgtable-level-check-in-pudp4d_alloc_one.patch asm-generic-pgalloc-provide-generic-p4d_alloc_onefree.patch