Skip to content

Commit b9c2ddb

Browse files
author
Fox Snowpatch
committed
1 parent 2a0bdd1 commit b9c2ddb

35 files changed

Lines changed: 194 additions & 191 deletions

File tree

‎Documentation/mm/process_addrs.rst‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,12 @@ We establish basic locking rules when interacting with page tables:
537537
* When changing a page table entry the page table lock for that page table
538538
**must** be held, except if you can safely assume nobody can access the page
539539
tables concurrently (such as on invocation of :c:func:`!free_pgtables`).
540+
* Page tables may be *walked* under RCU alone, as page tables are freed only
541+
after an RCU grace period has elapsed. However, any entry found must be
542+
revalidated after the page table lock is taken (such as the
543+
:c:func:`!pmd_same` recheck performed by :c:func:`!pte_offset_map_lock`)
544+
before it is acted upon. Changing an entry requires the page table
545+
lock and one of the locks that excludes teardown (mmap or VMA lock).
540546
* Reads from and writes to page table entries must be *appropriately*
541547
atomic. See the section on atomicity below for details.
542548
* Populating previously empty entries requires that the mmap or VMA locks are

‎arch/Kconfig‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -526,13 +526,6 @@ config HAVE_ARCH_JUMP_LABEL
526526
config HAVE_ARCH_JUMP_LABEL_RELATIVE
527527
bool
528528

529-
config MMU_GATHER_TABLE_FREE
530-
bool
531-
532-
config MMU_GATHER_RCU_TABLE_FREE
533-
bool
534-
select MMU_GATHER_TABLE_FREE
535-
536529
config MMU_GATHER_PAGE_SIZE
537530
bool
538531

@@ -548,7 +541,6 @@ config MMU_GATHER_MERGE_VMAS
548541

549542
config MMU_GATHER_NO_GATHER
550543
bool
551-
depends on MMU_GATHER_TABLE_FREE
552544

553545
config ARCH_WANT_IRQS_OFF_ACTIVATE_MM
554546
bool

‎arch/alpha/Kconfig‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ config ALPHA
4242
select ARCH_STACKWALK
4343
select CPU_NO_EFFICIENT_FFS if !ALPHA_EV67
4444
select MMU_GATHER_NO_RANGE
45-
select MMU_GATHER_RCU_TABLE_FREE
4645
select SPARSEMEM_EXTREME if SPARSEMEM
4746
select ZONE_DMA
4847
select TRACE_IRQFLAGS_SUPPORT

‎arch/arc/include/asm/pgalloc.h‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ static inline void p4d_populate(struct mm_struct *mm, p4d_t *p4dp, pud_t *pudp)
7272
set_p4d(p4dp, __p4d((unsigned long)pudp));
7373
}
7474

75-
#define __pud_free_tlb(tlb, pmd, addr) pud_free((tlb)->mm, pmd)
75+
#define __pud_free_tlb(tlb, pmd, addr) tlb_remove_ptdesc((tlb), virt_to_ptdesc(pmd))
7676

7777
#endif
7878

@@ -83,10 +83,10 @@ static inline void pud_populate(struct mm_struct *mm, pud_t *pudp, pmd_t *pmdp)
8383
set_pud(pudp, __pud((unsigned long)pmdp));
8484
}
8585

86-
#define __pmd_free_tlb(tlb, pmd, addr) pmd_free((tlb)->mm, pmd)
86+
#define __pmd_free_tlb(tlb, pmd, addr) tlb_remove_ptdesc((tlb), virt_to_ptdesc(pmd))
8787

8888
#endif
8989

90-
#define __pte_free_tlb(tlb, pte, addr) pte_free((tlb)->mm, pte)
90+
#define __pte_free_tlb(tlb, pte, addr) tlb_remove_ptdesc((tlb), page_ptdesc(pte))
9191

9292
#endif /* _ASM_ARC_PGALLOC_H */

‎arch/arm/Kconfig‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ config ARM
135135
select HAVE_PERF_REGS
136136
select HAVE_PERF_USER_STACK_DUMP
137137
select HAVE_POSIX_CPU_TIMERS_TASK_WORK
138-
select MMU_GATHER_RCU_TABLE_FREE if SMP && ARM_LPAE
139138
select HAVE_REGS_AND_STACK_ACCESS_API
140139
select HAVE_RSEQ
141140
select HAVE_RUST if CPU_LITTLE_ENDIAN && CPU_32v7 && !KASAN

‎arch/arm64/Kconfig‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,6 @@ config ARM64
222222
select HAVE_RELIABLE_STACKTRACE
223223
select HAVE_POSIX_CPU_TIMERS_TASK_WORK
224224
select HAVE_FUNCTION_ARG_ACCESS_API
225-
select MMU_GATHER_RCU_TABLE_FREE
226225
select HAVE_RSEQ
227226
select HAVE_RUST if RUSTC_SUPPORTS_ARM64
228227
select HAVE_STACKPROTECTOR

‎arch/loongarch/Kconfig‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,6 @@ config LOONGARCH
189189
select IRQ_LOONGARCH_CPU
190190
select LOCK_MM_AND_FIND_VMA
191191
select MMU_GATHER_MERGE_VMAS if MMU
192-
select MMU_GATHER_RCU_TABLE_FREE
193192
select MODULES_USE_ELF_RELA if MODULES
194193
select NEED_PER_CPU_EMBED_FIRST_CHUNK
195194
select NEED_PER_CPU_PAGE_FIRST_CHUNK

‎arch/m68k/Kconfig‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ config M68K
2929
select HAVE_ARCH_LIBGCC_H
3030
select HAVE_ARCH_SECCOMP
3131
select HAVE_ARCH_SECCOMP_FILTER
32+
select HAVE_ARCH_TLB_REMOVE_TABLE if MMU_MOTOROLA
3233
select HAVE_ASM_MODVERSIONS
3334
select HAVE_DEBUG_BUGVERBOSE
3435
select HAVE_EFFICIENT_UNALIGNED_ACCESS if !CPU_HAS_NO_UNALIGNED

‎arch/m68k/include/asm/mcf_pgalloc.h‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,7 @@ extern inline pmd_t *pmd_alloc_kernel(pgd_t *pgd, unsigned long address)
3939
static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pgtable,
4040
unsigned long address)
4141
{
42-
struct ptdesc *ptdesc = virt_to_ptdesc(pgtable);
43-
44-
pagetable_dtor(ptdesc);
45-
pagetable_free(ptdesc);
42+
tlb_remove_ptdesc(tlb, virt_to_ptdesc(pgtable));
4643
}
4744

4845
static inline pgtable_t pte_alloc_one(struct mm_struct *mm)

‎arch/m68k/include/asm/motorola_pgalloc.h‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ enum m68k_table_types {
1717
extern void init_pointer_table(void *table, int type);
1818
extern void *get_pointer_table(struct mm_struct *mm, int type);
1919
extern int free_pointer_table(void *table, int type);
20+
extern void __tlb_remove_table(void *table);
2021

2122
/*
2223
* Allocate and free page tables. The xxx_kernel() versions are
@@ -47,7 +48,7 @@ static inline void pte_free(struct mm_struct *mm, pgtable_t pgtable)
4748
static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pgtable,
4849
unsigned long address)
4950
{
50-
free_pointer_table(pgtable, TABLE_PTE);
51+
tlb_remove_table(tlb, (void *)((unsigned long)pgtable | TABLE_PTE));
5152
}
5253

5354

@@ -61,10 +62,10 @@ static inline int pmd_free(struct mm_struct *mm, pmd_t *pmd)
6162
return free_pointer_table(pmd, TABLE_PMD);
6263
}
6364

64-
static inline int __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd,
65-
unsigned long address)
65+
static inline void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd,
66+
unsigned long address)
6667
{
67-
return free_pointer_table(pmd, TABLE_PMD);
68+
tlb_remove_table(tlb, (void *)((unsigned long)pmd | TABLE_PMD));
6869
}
6970

7071

0 commit comments

Comments
 (0)