Skip to content

Commit e3ecf7c

Browse files
Qi Zhengakpm00
authored andcommitted
mm: pgtable: convert some architectures to use tlb_remove_ptdesc()
Now, the nine architectures of csky, hexagon, loongarch, m68k, mips, nios2, openrisc, sh and um do not select CONFIG_MMU_GATHER_RCU_TABLE_FREE, and just call pagetable_dtor() + tlb_remove_page_ptdesc() (the wrapper of tlb_remove_page()). This is the same as the implementation of tlb_remove_{ptdesc|table}() under !CONFIG_MMU_GATHER_TABLE_FREE, so convert these architectures to use tlb_remove_ptdesc(). The ultimate goal is to make the architecture only use tlb_remove_ptdesc() or tlb_remove_table() for page table pages. [[email protected]: v2] Link: https://lkml.kernel.org/r/[email protected] [[email protected]: remove trailing semi in arch/loongarch/include/asm/pgalloc.h] Link: https://lkml.kernel.org/r/19db3e8673b67bad2f1df1ab37f1c89d99eacfea.1740454179.git.zhengqi.arch@bytedance.com Signed-off-by: Qi Zheng <[email protected]> Suggested-by: Peter Zijlstra (Intel) <[email protected]> Reviewed-by: Kevin Brodsky <[email protected]> Acked-by: Geert Uytterhoeven <[email protected]> [m68k] Cc: Alexandre Ghiti <[email protected]> Cc: "Aneesh Kumar K.V" <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Dave Hansen <[email protected]> Cc: David Hildenbrand <[email protected]> Cc: Hugh Dickens <[email protected]> Cc: Jann Horn <[email protected]> Cc: Matthew Wilcow (Oracle) <[email protected]> Cc: "Mike Rapoport (IBM)" <[email protected]> Cc: Muchun Song <[email protected]> Cc: Nicholas Piggin <[email protected]> Cc: Rik van Riel <[email protected]> Cc: Vishal Moola (Oracle) <[email protected]> Cc: Will Deacon <[email protected]> Cc: Yu Zhao <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 1a03c27 commit e3ecf7c

File tree

9 files changed

+22
-55
lines changed

9 files changed

+22
-55
lines changed

arch/csky/include/asm/pgalloc.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,8 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm)
6161
return ret;
6262
}
6363

64-
#define __pte_free_tlb(tlb, pte, address) \
65-
do { \
66-
pagetable_dtor(page_ptdesc(pte)); \
67-
tlb_remove_page_ptdesc(tlb, page_ptdesc(pte)); \
68-
} while (0)
64+
#define __pte_free_tlb(tlb, pte, address) \
65+
tlb_remove_ptdesc((tlb), page_ptdesc(pte))
6966

7067
extern void pagetable_init(void);
7168
extern void mmu_init(unsigned long min_pfn, unsigned long max_pfn);

arch/hexagon/include/asm/pgalloc.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,7 @@ static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd,
8787
max_kernel_seg = pmdindex;
8888
}
8989

90-
#define __pte_free_tlb(tlb, pte, addr) \
91-
do { \
92-
pagetable_dtor((page_ptdesc(pte))); \
93-
tlb_remove_page_ptdesc((tlb), (page_ptdesc(pte))); \
94-
} while (0)
90+
#define __pte_free_tlb(tlb, pte, addr) \
91+
tlb_remove_ptdesc((tlb), page_ptdesc(pte))
9592

9693
#endif

arch/loongarch/include/asm/pgalloc.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,8 @@ static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm)
5555
return pte;
5656
}
5757

58-
#define __pte_free_tlb(tlb, pte, address) \
59-
do { \
60-
pagetable_dtor(page_ptdesc(pte)); \
61-
tlb_remove_page_ptdesc((tlb), page_ptdesc(pte)); \
62-
} while (0)
58+
#define __pte_free_tlb(tlb, pte, address) \
59+
tlb_remove_ptdesc((tlb), page_ptdesc(pte))
6360

6461
#ifndef __PAGETABLE_PMD_FOLDED
6562

arch/m68k/include/asm/sun3_pgalloc.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,8 @@
1717

1818
extern const char bad_pmd_string[];
1919

20-
#define __pte_free_tlb(tlb, pte, addr) \
21-
do { \
22-
pagetable_dtor(page_ptdesc(pte)); \
23-
tlb_remove_page_ptdesc((tlb), page_ptdesc(pte)); \
24-
} while (0)
20+
#define __pte_free_tlb(tlb, pte, addr) \
21+
tlb_remove_ptdesc((tlb), page_ptdesc(pte))
2522

2623
static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, pte_t *pte)
2724
{

arch/mips/include/asm/pgalloc.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,8 @@ static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd)
4848
extern void pgd_init(void *addr);
4949
extern pgd_t *pgd_alloc(struct mm_struct *mm);
5050

51-
#define __pte_free_tlb(tlb, pte, address) \
52-
do { \
53-
pagetable_dtor(page_ptdesc(pte)); \
54-
tlb_remove_page_ptdesc((tlb), page_ptdesc(pte)); \
55-
} while (0)
51+
#define __pte_free_tlb(tlb, pte, address) \
52+
tlb_remove_ptdesc((tlb), page_ptdesc(pte))
5653

5754
#ifndef __PAGETABLE_PMD_FOLDED
5855

arch/nios2/include/asm/pgalloc.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,7 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
2828

2929
extern pgd_t *pgd_alloc(struct mm_struct *mm);
3030

31-
#define __pte_free_tlb(tlb, pte, addr) \
32-
do { \
33-
pagetable_dtor(page_ptdesc(pte)); \
34-
tlb_remove_page_ptdesc((tlb), (page_ptdesc(pte))); \
35-
} while (0)
31+
#define __pte_free_tlb(tlb, pte, addr) \
32+
tlb_remove_ptdesc((tlb), page_ptdesc(pte))
3633

3734
#endif /* _ASM_NIOS2_PGALLOC_H */

arch/openrisc/include/asm/pgalloc.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,7 @@ extern inline pgd_t *pgd_alloc(struct mm_struct *mm)
6464

6565
extern pte_t *pte_alloc_one_kernel(struct mm_struct *mm);
6666

67-
#define __pte_free_tlb(tlb, pte, addr) \
68-
do { \
69-
pagetable_dtor(page_ptdesc(pte)); \
70-
tlb_remove_page_ptdesc((tlb), (page_ptdesc(pte))); \
71-
} while (0)
67+
#define __pte_free_tlb(tlb, pte, addr) \
68+
tlb_remove_ptdesc((tlb), page_ptdesc(pte))
7269

7370
#endif

arch/sh/include/asm/pgalloc.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,7 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
3232
set_pmd(pmd, __pmd((unsigned long)page_address(pte)));
3333
}
3434

35-
#define __pte_free_tlb(tlb, pte, addr) \
36-
do { \
37-
pagetable_dtor(page_ptdesc(pte)); \
38-
tlb_remove_page_ptdesc((tlb), (page_ptdesc(pte))); \
39-
} while (0)
35+
#define __pte_free_tlb(tlb, pte, addr) \
36+
tlb_remove_ptdesc((tlb), page_ptdesc(pte))
4037

4138
#endif /* __ASM_SH_PGALLOC_H */

arch/um/include/asm/pgalloc.h

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,27 +25,18 @@
2525
*/
2626
extern pgd_t *pgd_alloc(struct mm_struct *);
2727

28-
#define __pte_free_tlb(tlb, pte, address) \
29-
do { \
30-
pagetable_dtor(page_ptdesc(pte)); \
31-
tlb_remove_page_ptdesc((tlb), (page_ptdesc(pte))); \
32-
} while (0)
28+
#define __pte_free_tlb(tlb, pte, address) \
29+
tlb_remove_ptdesc((tlb), page_ptdesc(pte))
3330

3431
#if CONFIG_PGTABLE_LEVELS > 2
3532

36-
#define __pmd_free_tlb(tlb, pmd, address) \
37-
do { \
38-
pagetable_dtor(virt_to_ptdesc(pmd)); \
39-
tlb_remove_page_ptdesc((tlb), virt_to_ptdesc(pmd)); \
40-
} while (0)
33+
#define __pmd_free_tlb(tlb, pmd, address) \
34+
tlb_remove_ptdesc((tlb), virt_to_ptdesc(pmd))
4135

4236
#if CONFIG_PGTABLE_LEVELS > 3
4337

44-
#define __pud_free_tlb(tlb, pud, address) \
45-
do { \
46-
pagetable_dtor(virt_to_ptdesc(pud)); \
47-
tlb_remove_page_ptdesc((tlb), virt_to_ptdesc(pud)); \
48-
} while (0)
38+
#define __pud_free_tlb(tlb, pud, address) \
39+
tlb_remove_ptdesc((tlb), virt_to_ptdesc(pud))
4940

5041
#endif
5142
#endif

0 commit comments

Comments
 (0)