The patch titled Subject: mm: convert ptlock_free() to use ptdescs has been added to the -mm mm-unstable branch. Its filename is mm-convert-ptlock_free-to-use-ptdescs.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-convert-ptlock_free-to-use-ptdescs.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: "Vishal Moola (Oracle)" <vishal.moola@xxxxxxxxx> Subject: mm: convert ptlock_free() to use ptdescs Date: Mon, 31 Jul 2023 10:03:11 -0700 This removes some direct accesses to struct page, working towards splitting out struct ptdesc from struct page. Link: https://lkml.kernel.org/r/20230731170332.69404-11-vishal.moola@xxxxxxxxx Signed-off-by: Vishal Moola (Oracle) <vishal.moola@xxxxxxxxx> Acked-by: Mike Rapoport (IBM) <rppt@xxxxxxxxxx> Cc: Arnd Bergmann <arnd@xxxxxxxx> Cc: Catalin Marinas <catalin.marinas@xxxxxxx> Cc: Christophe Leroy <christophe.leroy@xxxxxxxxxx> Cc: Claudio Imbrenda <imbrenda@xxxxxxxxxxxxx> Cc: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx> Cc: David Hildenbrand <david@xxxxxxxxxx> Cc: David S. Miller <davem@xxxxxxxxxxxxx> Cc: Dinh Nguyen <dinguyen@xxxxxxxxxx> Cc: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx> Cc: Geert Uytterhoeven <geert+renesas@xxxxxxxxx> Cc: Guo Ren <guoren@xxxxxxxxxx> Cc: Huacai Chen <chenhuacai@xxxxxxxxxx> Cc: Hugh Dickins <hughd@xxxxxxxxxx> Cc: John Paul Adrian Glaubitz <glaubitz@xxxxxxxxxxxxxxxxxxx> Cc: Jonas Bonn <jonas@xxxxxxxxxxxx> Cc: Matthew Wilcox <willy@xxxxxxxxxxxxx> Cc: Palmer Dabbelt <palmer@xxxxxxxxxxxx> Cc: Paul Walmsley <paul.walmsley@xxxxxxxxxx> Cc: Richard Weinberger <richard@xxxxxx> Cc: Thomas Bogendoerfer <tsbogend@xxxxxxxxxxxxxxxx> Cc: Yoshinori Sato <ysato@xxxxxxxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- include/linux/mm.h | 10 +++++----- mm/memory.c | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) --- a/include/linux/mm.h~mm-convert-ptlock_free-to-use-ptdescs +++ a/include/linux/mm.h @@ -2855,7 +2855,7 @@ static inline void pagetable_free(struct #if ALLOC_SPLIT_PTLOCKS void __init ptlock_cache_init(void); bool ptlock_alloc(struct ptdesc *ptdesc); -extern void ptlock_free(struct page *page); +void ptlock_free(struct ptdesc *ptdesc); static inline spinlock_t *ptlock_ptr(struct ptdesc *ptdesc) { @@ -2871,7 +2871,7 @@ static inline bool ptlock_alloc(struct p return true; } -static inline void ptlock_free(struct page *page) +static inline void ptlock_free(struct ptdesc *ptdesc) { } @@ -2912,7 +2912,7 @@ static inline spinlock_t *pte_lockptr(st } static inline void ptlock_cache_init(void) {} static inline bool ptlock_init(struct ptdesc *ptdesc) { return true; } -static inline void ptlock_free(struct page *page) {} +static inline void ptlock_free(struct ptdesc *ptdesc) {} #endif /* USE_SPLIT_PTE_PTLOCKS */ static inline bool pgtable_pte_page_ctor(struct page *page) @@ -2926,7 +2926,7 @@ static inline bool pgtable_pte_page_ctor static inline void pgtable_pte_page_dtor(struct page *page) { - ptlock_free(page); + ptlock_free(page_ptdesc(page)); __ClearPageTable(page); dec_lruvec_page_state(page, NR_PAGETABLE); } @@ -3000,7 +3000,7 @@ static inline void pmd_ptlock_free(struc #ifdef CONFIG_TRANSPARENT_HUGEPAGE VM_BUG_ON_PAGE(ptdesc->pmd_huge_pte, ptdesc_page(ptdesc)); #endif - ptlock_free(ptdesc_page(ptdesc)); + ptlock_free(ptdesc); } #define pmd_huge_pte(mm, pmd) (pmd_ptdesc(pmd)->pmd_huge_pte) --- a/mm/memory.c~mm-convert-ptlock_free-to-use-ptdescs +++ a/mm/memory.c @@ -6261,8 +6261,8 @@ bool ptlock_alloc(struct ptdesc *ptdesc) return true; } -void ptlock_free(struct page *page) +void ptlock_free(struct ptdesc *ptdesc) { - kmem_cache_free(page_ptl_cachep, page->ptl); + kmem_cache_free(page_ptl_cachep, ptdesc->ptl); } #endif _ Patches currently in -mm which might be from vishal.moola@xxxxxxxxx are mm-add-page_type_op-folio-functions.patch pgtable-create-struct-ptdesc.patch mm-add-utility-functions-for-ptdesc.patch mm-convert-pmd_pgtable_page-callers-to-use-pmd_ptdesc.patch mm-convert-ptlock_alloc-to-use-ptdescs.patch mm-convert-ptlock_ptr-to-use-ptdescs.patch mm-convert-pmd_ptlock_init-to-use-ptdescs.patch mm-convert-ptlock_init-to-use-ptdescs.patch mm-convert-pmd_ptlock_free-to-use-ptdescs.patch mm-convert-ptlock_free-to-use-ptdescs.patch mm-create-ptdesc-equivalents-for-pgtable_ptepmd_page_ctordtor.patch powerpc-convert-various-functions-to-use-ptdescs.patch x86-convert-various-functions-to-use-ptdescs.patch s390-convert-various-pgalloc-functions-to-use-ptdescs.patch mm-remove-page-table-members-from-struct-page.patch pgalloc-convert-various-functions-to-use-ptdescs.patch arm-convert-various-functions-to-use-ptdescs.patch arm64-convert-various-functions-to-use-ptdescs.patch csky-convert-__pte_free_tlb-to-use-ptdescs.patch hexagon-convert-__pte_free_tlb-to-use-ptdescs.patch loongarch-convert-various-functions-to-use-ptdescs.patch m68k-convert-various-functions-to-use-ptdescs.patch mips-convert-various-functions-to-use-ptdescs.patch nios2-convert-__pte_free_tlb-to-use-ptdescs.patch openrisc-convert-__pte_free_tlb-to-use-ptdescs.patch riscv-convert-alloc_pmd-pte_late-to-use-ptdescs.patch sh-convert-pte_free_tlb-to-use-ptdescs.patch sparc64-convert-various-functions-to-use-ptdescs.patch sparc-convert-pgtable_pte_page_ctor-dtor-to-ptdesc-equivalents.patch um-convert-pmd-pte_free_tlb-to-use-ptdescs.patch mm-remove-pgtable_pmd-pte_page_ctor-dtor-wrappers.patch