mm-support-tlbbatch-flush-for-a-range-of-ptes.patch removed from -mm tree
The quilt patch titled
Subject: mm: support tlbbatch flush for a range of PTEs
has been removed from the -mm tree. Its filename was
mm-support-tlbbatch-flush-for-a-range-of-ptes.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: Barry Song <[email protected]>
Subject: mm: support tlbbatch flush for a range of PTEs
Date: Fri, 14 Feb 2025 22:30:13 +1300
This patch lays the groundwork for supporting batch PTE unmapping in try_to_unmap_one(). It introduces range handling for TLB batch flushing, with the range currently set to the size of PAGE_SIZE.
The function __flush_tlb_range_nosync() is architecture-specific and is only used within arch/arm64. This function requires the mm structure instead of the vma structure. To allow its reuse by arch_tlbbatch_add_pending(), which operates with mm but not vma, this patch modifies the argument of __flush_tlb_range_nosync() to take mm as its parameter.
---
arch/arm64/include/asm/tlbflush.h | 23 +++++++++++------------ arch/arm64/mm/contpte.c | 2 +- arch/riscv/include/asm/tlbflush.h | 3 +-- arch/riscv/mm/tlbflush.c | 3 +-- arch/x86/include/asm/tlbflush.h | 3 +-- mm/rmap.c | 10 +++++----- 6 files changed, 20 insertions(+), 24 deletions(-)
arch/arm64/include/asm/tlbflush.h renamed from arch/arm64/include/asm/tlbflush.h~mm-support-tlbbatch-flush-for-a-range-of-ptes +11 -12
@@ -322,13 +322,6 @@ static inline bool arch_tlbbatch_should_return true; } -static inline void arch_tlbbatch_add_pending (struct arch_tlbflush_unmap_batch *batch, -struct mm_struct *mm, -unsigned long uaddr) -{ -__flush_tlb_page_nosync (mm, uaddr); -} -/* * If mprotect/munmap/etc occurs during TLB batched flushing, we need to * synchronise all the TLBI issued with a DSB to avoid the race mentioned in
@@ -448,7 +441,7 @@ static inline bool __flush_tlb_range_limreturn false; } -static inline void __flush_tlb_range_nosync (struct vm_area_struct *vma, +static inline void __flush_tlb_range_nosync (struct mm_struct *mm,unsigned long start,unsigned long end,unsigned long stride,bool last_level,int tlb_level)
@@ -460,12 +453,12 @@ static inline void __flush_tlb_range_nos pages = (end - start) >>PAGE_SHIFT ;if (__flush_tlb_range_limit_excess (start, end, pages, stride)) { -flush_tlb_mm (vma->vm_mm); +flush_tlb_mm (mm);return ; }dsb (ishst); - asid =ASID (vma->vm_mm); + asid =ASID (mm);if (last_level) __flush_tlb_range_op(vale1is, start, pages, stride, asid,
@@ -474,7 +467,7 @@ static inline void __flush_tlb_range_nos__flush_tlb_range_op (vae1is, start, pages, stride, asid, tlb_level, true,lpa2_is_enabled ()); -mmu_notifier_arch_invalidate_secondary_tlbs (vma->vm_mm, start, end); +mmu_notifier_arch_invalidate_secondary_tlbs (mm, start, end); } static inline void __flush_tlb_range(struct vm_area_struct *vma,
@@ -482,7 +475,7 @@ static inline void __flush_tlb_range(str unsigned long stride, bool last_level, int tlb_level) { -__flush_tlb_range_nosync (vma ,start ,end ,stride , + __flush_tlb_range_nosync(vma->vm_mm, start, end, stride,last_level ,tlb_level );dsb (ish); }
@@ -533,6 +526,12 @@ static inline void __flush_tlb_kernel_pgdsb (ish);isb (); } + +static inline void arch_tlbbatch_add_pending (struct arch_tlbflush_unmap_batch *batch, +struct mm_struct *mm,unsigned long start,unsigned long end) +{ +__flush_tlb_range_nosync (mm, start, end,PAGE_SIZE , true,3 ); +}#endif #endif
arch/arm64/mm/contpte.c renamed from arch/arm64/mm/contpte.c~mm-support-tlbbatch-flush-for-a-range-of-ptes +1 -1
@@ -335,7 +335,7 @@ int contpte_ptep_clear_flush_young(struc* eliding the trailing DSB applies here. */ addr =ALIGN_DOWN (addr,CONT_PTE_SIZE ); -__flush_tlb_range_nosync (vma, addr, addr +CONT_PTE_SIZE , +__flush_tlb_range_nosync (vma->vm_mm, addr, addr +CONT_PTE_SIZE ,PAGE_SIZE , true,3 ); }
arch/riscv/include/asm/tlbflush.h renamed from arch/riscv/include/asm/tlbflush.h~mm-support-tlbbatch-flush-for-a-range-of-ptes +1 -2
@@ -60,8 +60,7 @@ void flush_pmd_tlb_range(struct vm_area_bool arch_tlbbatch_should_defer (struct mm_struct *mm);void arch_tlbbatch_add_pending (struct arch_tlbflush_unmap_batch *batch, -struct mm_struct *mm, -unsigned long uaddr); +struct mm_struct *mm,unsigned long start,unsigned long end);void arch_flush_tlb_batched_pending (struct mm_struct *mm);void arch_tlbbatch_flush (struct arch_tlbflush_unmap_batch *batch);
arch/riscv/mm/tlbflush.c renamed from arch/riscv/mm/tlbflush.c~mm-support-tlbbatch-flush-for-a-range-of-ptes +1 -2
@@ -186,8 +186,7 @@ bool arch_tlbbatch_should_defer(struct m }void arch_tlbbatch_add_pending (struct arch_tlbflush_unmap_batch *batch, -struct mm_struct *mm, -unsigned long uaddr) +struct mm_struct *mm,unsigned long start,unsigned long end) {cpumask_or (&batch->cpumask, &batch->cpumask,mm_cpumask (mm)); }
arch/x86/include/asm/tlbflush.h renamed from arch/x86/include/asm/tlbflush.h~mm-support-tlbbatch-flush-for-a-range-of-ptes +1 -2
@@ -279,8 +279,7 @@ static inline u64 inc_mm_tlb_gen(struct }static inline void arch_tlbbatch_add_pending (struct arch_tlbflush_unmap_batch *batch, -struct mm_struct *mm, -unsigned long uaddr) +struct mm_struct *mm,unsigned long start,unsigned long end) {inc_mm_tlb_gen (mm);cpumask_or (&batch->cpumask, &batch->cpumask,mm_cpumask (mm));
mm/rmap.c renamed from mm/rmap.c~mm-support-tlbbatch-flush-for-a-range-of-ptes +5 -5
@@ -672,7 +672,7 @@ void try_to_unmap_flush_dirty(void) (TLB_FLUSH_BATCH_PENDING_MASK / 2)static void set_tlb_ubc_flush_pending (struct mm_struct *mm,pte_t pteval, -unsigned long uaddr) +unsigned long start,unsigned long end) {struct tlbflush_unmap_batch *tlb_ubc = ¤t->tlb_ubc;int batch;
@@ -681,7 +681,7 @@ static void set_tlb_ubc_flush_pending(stif (!pte_accessible (mm, pteval))return ; -arch_tlbbatch_add_pending (&tlb_ubc->arch, mm, uaddr); +arch_tlbbatch_add_pending (&tlb_ubc->arch, mm, start, end); tlb_ubc->flush_required = true;/*
@@ -757,7 +757,7 @@ void flush_tlb_batched_pending(struct mm }#else static void set_tlb_ubc_flush_pending (struct mm_struct *mm,pte_t pteval, -unsigned long uaddr) +unsigned long start,unsigned long end) { }
@@ -1887,7 +1887,7 @@ static bool try_to_unmap_one(struct foli*/ pteval =ptep_get_and_clear (mm, address, pvmw.pte); -set_tlb_ubc_flush_pending (mm, pteval, address); +set_tlb_ubc_flush_pending (mm, pteval, address, address +PAGE_SIZE ); }else { pteval =ptep_clear_flush (vma, address, pvmw.pte); }
@@ -2270,7 +2270,7 @@ static bool try_to_migrate_one(struct fo*/ pteval =ptep_get_and_clear (mm, address, pvmw.pte); -set_tlb_ubc_flush_pending (mm, pteval, address); +set_tlb_ubc_flush_pending (mm, pteval, address, address +PAGE_SIZE ); }else { pteval =ptep_clear_flush (vma, address, pvmw.pte); }
_
Patches currently in -mm which might be from [email protected] are