Skip to content

Commit 1e9fdf2

Browse files
Peter Zijlstratorvalds
authored andcommitted
mmu_gather: Remove per arch tlb_{start,end}_vma()
Scattered across the archs are 3 basic forms of tlb_{start,end}_vma(). Provide two new MMU_GATHER_knobs to enumerate them and remove the per arch tlb_{start,end}_vma() implementations. - MMU_GATHER_NO_FLUSH_CACHE indicates the arch has flush_cache_range() but does *NOT* want to call it for each VMA. - MMU_GATHER_MERGE_VMAS indicates the arch wants to merge the invalidate across multiple VMAs if possible. With these it is possible to capture the three forms: 1) empty stubs; select MMU_GATHER_NO_FLUSH_CACHE and MMU_GATHER_MERGE_VMAS 2) start: flush_cache_range(), end: empty; select MMU_GATHER_MERGE_VMAS 3) start: flush_cache_range(), end: flush_tlb_range(); default Obviously, if the architecture does not have flush_cache_range() then it also doesn't need to select MMU_GATHER_NO_FLUSH_CACHE. Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Acked-by: Will Deacon <[email protected]> Cc: David Miller <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 23a6761 commit 1e9fdf2

File tree

13 files changed

+32
-35
lines changed

13 files changed

+32
-35
lines changed

arch/Kconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,13 @@ config MMU_GATHER_PAGE_SIZE
438438

439439
config MMU_GATHER_NO_RANGE
440440
bool
441+
select MMU_GATHER_MERGE_VMAS
442+
443+
config MMU_GATHER_NO_FLUSH_CACHE
444+
bool
445+
446+
config MMU_GATHER_MERGE_VMAS
447+
bool
441448

442449
config MMU_GATHER_NO_GATHER
443450
bool

arch/csky/include/asm/tlb.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,6 @@
44
#define __ASM_CSKY_TLB_H
55

66
#include <asm/cacheflush.h>
7-
8-
#define tlb_start_vma(tlb, vma) \
9-
do { \
10-
if (!(tlb)->fullmm) \
11-
flush_cache_range(vma, (vma)->vm_start, (vma)->vm_end); \
12-
} while (0)
13-
14-
#define tlb_end_vma(tlb, vma) \
15-
do { \
16-
if (!(tlb)->fullmm) \
17-
flush_tlb_range(vma, (vma)->vm_start, (vma)->vm_end); \
18-
} while (0)
19-
207
#define tlb_flush(tlb) flush_tlb_mm((tlb)->mm)
218

229
#include <asm-generic/tlb.h>

arch/loongarch/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ config LOONGARCH
108108
select TRACE_IRQFLAGS_SUPPORT
109109
select USE_PERCPU_NUMA_NODE_ID
110110
select ZONE_DMA32
111+
select MMU_GATHER_MERGE_VMAS if MMU
111112

112113
config 32BIT
113114
bool

arch/loongarch/include/asm/tlb.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -137,16 +137,6 @@ static inline void invtlb_all(u32 op, u32 info, u64 addr)
137137
);
138138
}
139139

140-
/*
141-
* LoongArch doesn't need any special per-pte or per-vma handling, except
142-
* we need to flush cache for area to be unmapped.
143-
*/
144-
#define tlb_start_vma(tlb, vma) \
145-
do { \
146-
if (!(tlb)->fullmm) \
147-
flush_cache_range(vma, vma->vm_start, vma->vm_end); \
148-
} while (0)
149-
#define tlb_end_vma(tlb, vma) do { } while (0)
150140
#define __tlb_remove_tlb_entry(tlb, ptep, address) do { } while (0)
151141

152142
static void tlb_flush(struct mmu_gather *tlb);

arch/powerpc/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ config PPC
256256
select IRQ_FORCED_THREADING
257257
select MMU_GATHER_PAGE_SIZE
258258
select MMU_GATHER_RCU_TABLE_FREE
259+
select MMU_GATHER_MERGE_VMAS
259260
select MODULES_USE_ELF_RELA
260261
select NEED_DMA_MAP_STATE if PPC64 || NOT_COHERENT_CACHE
261262
select NEED_PER_CPU_EMBED_FIRST_CHUNK if PPC64

arch/powerpc/include/asm/tlb.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919

2020
#include <linux/pagemap.h>
2121

22-
#define tlb_start_vma(tlb, vma) do { } while (0)
23-
#define tlb_end_vma(tlb, vma) do { } while (0)
2422
#define __tlb_remove_tlb_entry __tlb_remove_tlb_entry
2523

2624
#define tlb_flush tlb_flush

arch/s390/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ config S390
204204
select IOMMU_SUPPORT if PCI
205205
select MMU_GATHER_NO_GATHER
206206
select MMU_GATHER_RCU_TABLE_FREE
207+
select MMU_GATHER_MERGE_VMAS
207208
select MODULES_USE_ELF_RELA
208209
select NEED_DMA_MAP_STATE if PCI
209210
select NEED_SG_DMA_LENGTH if PCI

arch/s390/include/asm/tlb.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ static inline void tlb_flush(struct mmu_gather *tlb);
2727
static inline bool __tlb_remove_page_size(struct mmu_gather *tlb,
2828
struct page *page, int page_size);
2929

30-
#define tlb_start_vma(tlb, vma) do { } while (0)
31-
#define tlb_end_vma(tlb, vma) do { } while (0)
32-
3330
#define tlb_flush tlb_flush
3431
#define pte_free_tlb pte_free_tlb
3532
#define pmd_free_tlb pmd_free_tlb

arch/sparc/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ config SPARC64
6767
select HAVE_KRETPROBES
6868
select HAVE_KPROBES
6969
select MMU_GATHER_RCU_TABLE_FREE if SMP
70+
select MMU_GATHER_MERGE_VMAS
71+
select MMU_GATHER_NO_FLUSH_CACHE
7072
select HAVE_ARCH_TRANSPARENT_HUGEPAGE
7173
select HAVE_DYNAMIC_FTRACE
7274
select HAVE_FTRACE_MCOUNT_RECORD

arch/sparc/include/asm/tlb_64.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ void smp_flush_tlb_mm(struct mm_struct *mm);
2222
void __flush_tlb_pending(unsigned long, unsigned long, unsigned long *);
2323
void flush_tlb_pending(void);
2424

25-
#define tlb_start_vma(tlb, vma) do { } while (0)
26-
#define tlb_end_vma(tlb, vma) do { } while (0)
2725
#define tlb_flush(tlb) flush_tlb_pending()
2826

2927
/*

0 commit comments

Comments
 (0)