[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z36gsNyRhb3wCPvN@li-008a6a4c-3549-11b2-a85c-c5cc2836eea2.ibm.com>
Date: Wed, 8 Jan 2025 16:58:40 +0100
From: Alexander Gordeev <agordeev@...ux.ibm.com>
To: Qi Zheng <zhengqi.arch@...edance.com>
Cc: peterz@...radead.org, kevin.brodsky@....com, alex@...ti.fr,
andreas@...sler.com, palmer@...belt.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@...db.de, 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 v5 13/17] s390: pgtable: consolidate PxD and PTE TLB free
paths
On Wed, Jan 08, 2025 at 02:57:29PM +0800, Qi Zheng wrote:
> Call pagetable_dtor() for PMD|PUD|P4D tables just before ptdesc is
> freed - same as it is done for PTE tables. That allows consolidating
> TLB free paths for all table types.
>
> Signed-off-by: Qi Zheng <zhengqi.arch@...edance.com>
> Suggested-by: Peter Zijlstra (Intel) <peterz@...radead.org>
> Reviewed-by: Kevin Brodsky <kevin.brodsky@....com>
> Cc: linux-s390@...r.kernel.org
> ---
> arch/s390/include/asm/tlb.h | 3 ---
> arch/s390/mm/pgalloc.c | 14 ++++----------
> 2 files changed, 4 insertions(+), 13 deletions(-)
>
> diff --git a/arch/s390/include/asm/tlb.h b/arch/s390/include/asm/tlb.h
> index dde847a5be545..d5b27a2445c96 100644
> --- a/arch/s390/include/asm/tlb.h
> +++ b/arch/s390/include/asm/tlb.h
> @@ -102,7 +102,6 @@ static inline void pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd,
> {
> if (mm_pmd_folded(tlb->mm))
> return;
> - pagetable_dtor(virt_to_ptdesc(pmd));
> __tlb_adjust_range(tlb, address, PAGE_SIZE);
> tlb->mm->context.flush_mm = 1;
> tlb->freed_tables = 1;
> @@ -122,7 +121,6 @@ static inline void p4d_free_tlb(struct mmu_gather *tlb, p4d_t *p4d,
> {
> if (mm_p4d_folded(tlb->mm))
> return;
> - pagetable_dtor(virt_to_ptdesc(p4d));
> __tlb_adjust_range(tlb, address, PAGE_SIZE);
> tlb->mm->context.flush_mm = 1;
> tlb->freed_tables = 1;
> @@ -141,7 +139,6 @@ static inline void pud_free_tlb(struct mmu_gather *tlb, pud_t *pud,
> {
> if (mm_pud_folded(tlb->mm))
> return;
> - pagetable_dtor(virt_to_ptdesc(pud));
> tlb->mm->context.flush_mm = 1;
> tlb->freed_tables = 1;
> tlb->cleared_p4ds = 1;
> diff --git a/arch/s390/mm/pgalloc.c b/arch/s390/mm/pgalloc.c
> index 569de24d33761..c73b89811a264 100644
> --- a/arch/s390/mm/pgalloc.c
> +++ b/arch/s390/mm/pgalloc.c
> @@ -180,7 +180,7 @@ unsigned long *page_table_alloc(struct mm_struct *mm)
> return table;
> }
>
> -static void pagetable_pte_dtor_free(struct ptdesc *ptdesc)
> +static void pagetable_dtor_free(struct ptdesc *ptdesc)
> {
> pagetable_dtor(ptdesc);
> pagetable_free(ptdesc);
> @@ -190,20 +190,14 @@ void page_table_free(struct mm_struct *mm, unsigned long *table)
> {
> struct ptdesc *ptdesc = virt_to_ptdesc(table);
>
> - pagetable_pte_dtor_free(ptdesc);
> + pagetable_dtor_free(ptdesc);
> }
>
> void __tlb_remove_table(void *table)
> {
> struct ptdesc *ptdesc = virt_to_ptdesc(table);
> - struct page *page = ptdesc_page(ptdesc);
>
> - if (compound_order(page) == CRST_ALLOC_ORDER) {
> - /* pmd, pud, or p4d */
> - pagetable_free(ptdesc);
> - return;
> - }
> - pagetable_pte_dtor_free(ptdesc);
> + pagetable_dtor_free(ptdesc);
> }
>
> #ifdef CONFIG_TRANSPARENT_HUGEPAGE
> @@ -211,7 +205,7 @@ static void pte_free_now(struct rcu_head *head)
> {
> struct ptdesc *ptdesc = container_of(head, struct ptdesc, pt_rcu_head);
>
> - pagetable_pte_dtor_free(ptdesc);
> + pagetable_dtor_free(ptdesc);
> }
>
> void pte_free_defer(struct mm_struct *mm, pgtable_t pgtable)
Acked-by: Alexander Gordeev <agordeev@...ux.ibm.com>
Thanks!
Powered by blists - more mailing lists