[PATCH] LoongArch: mm: drop redundant flush_tlb_all() from set_pmd_at()

Song Hu posted 1 patch 1 week, 3 days ago
arch/loongarch/mm/pgtable.c | 2 --
1 file changed, 2 deletions(-)
[PATCH] LoongArch: mm: drop redundant flush_tlb_all() from set_pmd_at()
Posted by Song Hu 1 week, 3 days ago
set_pmd_at() unconditionally calls flush_tlb_all(), a synchronous all-CPU
IPI that flushes the entire TLB and blocks until every CPU finishes.  It
runs on every PMD installation, and is the only LoongArch setter that
flushes -- set_pte(), set_pud() and set_p4d() do a plain store.

The flush is unnecessary: set_p*_at() only writes the entry, and every
caller already invalidates.  vmemmap_set_pmd() writes a pmd_none() slot,
and the THP, rmap, migration, mremap and NUMA-hinting paths all pair the
write with pmdp_invalidate(), pmdp_huge_clear_flush() or flush_tlb_range().

Drop the call, and the now-unused <asm/tlbflush.h> include.

Fixes: 09cfefb7fa70c ("LoongArch: Add memory management")
Co-developed-by: Tao Cui <cuitao@kylinos.cn>
Signed-off-by: Tao Cui <cuitao@kylinos.cn>
Signed-off-by: Song Hu <husong@kylinos.cn>
---
 arch/loongarch/mm/pgtable.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/loongarch/mm/pgtable.c b/arch/loongarch/mm/pgtable.c
index 4ee188e38fed..5bff95e3f375 100644
--- a/arch/loongarch/mm/pgtable.c
+++ b/arch/loongarch/mm/pgtable.c
@@ -8,7 +8,6 @@
 #include <asm/fixmap.h>
 #include <asm/pgalloc.h>
 #include <asm/pgtable.h>
-#include <asm/tlbflush.h>
 
 struct page *dmw_virt_to_page(unsigned long kaddr)
 {
@@ -140,7 +139,6 @@ void set_pmd_at(struct mm_struct *mm, unsigned long addr,
 		pmd_t *pmdp, pmd_t pmd)
 {
 	WRITE_ONCE(*pmdp, pmd);
-	flush_tlb_all();
 }
 
 void __init pagetable_init(void)
-- 
2.43.0