asm-generic-pgalloc-provide-generic-p4d_alloc_onefree.patch removed from -mm tree
The quilt patch titled
Subject: asm-generic: pgalloc: provide generic p4d_{alloc_one,free}has been removed from the -mm tree. Its filename was
asm-generic-pgalloc-provide-generic-p4d_alloc_onefree.patch
This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Kevin Brodsky <[email protected]>
Subject: asm-generic: pgalloc: provide generic p4d_{alloc_one,free}
Date: Wed, 8 Jan 2025 14:57:19 +0800
Four architectures currently implement 5-level pgtables: arm64, riscv, x86 and s390. The first three have essentially the same implementation for p4d_alloc_one() and p4d_free(), so we've got an opportunity to reduce duplication like at the lower levels.
Provide a generic version of p4d_alloc_one() and p4d_free(), and make use of it on those architectures.
Their implementation is the same as at PUD level, except that p4d_free() performs a runtime check by calling mm_p4d_folded(). 5-level pgtables depend on a runtime-detected hardware feature on all supported architectures, so we might as well include this check in the generic implementation. No runtime check is required in p4d_alloc_one() as the top-level p4d_alloc() already does the required check.
---
arch/arm64/include/asm/pgalloc.h | 17 ---------- arch/riscv/include/asm/pgalloc.h | 23 -------------- arch/x86/include/asm/pgalloc.h | 18 ----------- include/asm-generic/pgalloc.h | 45 +++++++++++++++++++++++++++++ 4 files changed, 45 insertions(+), 58 deletions(-)
arch/arm64/include/asm/pgalloc.h renamed from arch/arm64/include/asm/pgalloc.h~asm-generic-pgalloc-provide-generic-p4d_alloc_onefree +0 -17
@@ -85,23 +85,6 @@ static inline void pgd_populate(struct m __pgd_populate(pgdp, __pa(p4dp), pgdval); } -static inline p4d_t *p4d_alloc_one (struct mm_struct *mm,unsigned long addr) -{ -gfp_t gfp =GFP_PGTABLE_USER ; - -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) -{ -if (!pgtable_l5_enabled ()) -return ; -BUG_ON ((unsigned long )p4d & (PAGE_SIZE -1 )); -free_page ((unsigned long )p4d); -} -#define __p4d_free_tlb (tlb, p4d, addr) p4d_free((tlb)->mm, p4d)#else static inline void __pgd_populate (pgd_t *pgdp,phys_addr_t p4dp,pgdval_t prot)
arch/riscv/include/asm/pgalloc.h renamed from arch/riscv/include/asm/pgalloc.h~asm-generic-pgalloc-provide-generic-p4d_alloc_onefree +0 -23
@@ -105,29 +105,6 @@ 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) -{ -gfp_t gfp =GFP_PGTABLE_USER ; - -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) -{ -BUG_ON ((unsigned long )p4d & (PAGE_SIZE -1 )); -free_page ((unsigned long )p4d); -} - -#define p4d_free p4d_free -static inline void p4d_free (struct mm_struct *mm,p4d_t *p4d) -{ -if (pgtable_l5_enabled) -__p4d_free (mm, p4d); -} -static inline void __p4d_free_tlb (struct mmu_gather *tlb,p4d_t *p4d,unsigned long addr) {
arch/x86/include/asm/pgalloc.h renamed from arch/x86/include/asm/pgalloc.h~asm-generic-pgalloc-provide-generic-p4d_alloc_onefree +0 -18
@@ -147,24 +147,6 @@ static inline void pgd_populate_safe(strset_pgd_safe (pgd,__pgd (_PAGE_TABLE |__pa (p4d))); } -static inline p4d_t *p4d_alloc_one (struct mm_struct *mm,unsigned long addr) -{ -gfp_t gfp =GFP_KERNEL_ACCOUNT ; - -if (mm == &init_mm) - gfp &= ~__GFP_ACCOUNT; -return (p4d_t *)get_zeroed_page (gfp); -} - -static inline void p4d_free (struct mm_struct *mm,p4d_t *p4d) -{ -if (!pgtable_l5_enabled ()) -return ; - -BUG_ON ((unsigned long )p4d & (PAGE_SIZE -1 )); -free_page ((unsigned long )p4d); -} -extern void ___p4d_free_tlb (struct mmu_gather *tlb,p4d_t *p4d); static inline void __p4d_free_tlb(struct mmu_gather *tlb, p4d_t *p4d,
include/asm-generic/pgalloc.h renamed from include/asm-generic/pgalloc.h~asm-generic-pgalloc-provide-generic-p4d_alloc_onefree +45 -0
51 lines not on this page · raw message
_
Patches currently in -mm which might be from [email protected] are