Skip to content

Commit 7964cf8

Browse files
howlettakpm00
authored andcommitted
mm: remove vmacache
By using the maple tree and the maple tree state, the vmacache is no longer beneficial and is complicating the VMA code. Remove the vmacache to reduce the work in keeping it up to date and code complexity. Link: https://lkml.kernel.org/r/20220906194824.2110408-26-Liam.Howlett@oracle.com Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com> Acked-by: Vlastimil Babka <vbabka@suse.cz> Tested-by: Yu Zhao <yuzhao@google.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: David Hildenbrand <david@redhat.com> Cc: David Howells <dhowells@redhat.com> Cc: Davidlohr Bueso <dave@stgolabs.net> Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org> Cc: SeongJae Park <sj@kernel.org> Cc: Sven Schnelle <svens@linux.ibm.com> Cc: Will Deacon <will@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 4dd1b84 commit 7964cf8

File tree

17 files changed

+9
-267
lines changed

17 files changed

+9
-267
lines changed

fs/exec.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
#include <linux/file.h>
2929
#include <linux/fdtable.h>
3030
#include <linux/mm.h>
31-
#include <linux/vmacache.h>
3231
#include <linux/stat.h>
3332
#include <linux/fcntl.h>
3433
#include <linux/swap.h>
@@ -1027,8 +1026,6 @@ static int exec_mmap(struct mm_struct *mm)
10271026
activate_mm(active_mm, mm);
10281027
if (IS_ENABLED(CONFIG_ARCH_WANT_IRQS_OFF_ACTIVATE_MM))
10291028
local_irq_enable();
1030-
tsk->mm->vmacache_seqnum = 0;
1031-
vmacache_flush(tsk);
10321029
task_unlock(tsk);
10331030
lru_gen_use_mm(mm);
10341031

fs/proc/task_mmu.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// SPDX-License-Identifier: GPL-2.0
22
#include <linux/pagewalk.h>
3-
#include <linux/vmacache.h>
43
#include <linux/mm_inline.h>
54
#include <linux/hugetlb.h>
65
#include <linux/huge_mm.h>

include/linux/mm_types.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,6 @@ struct mm_struct {
475475
struct {
476476
struct vm_area_struct *mmap; /* list of VMAs */
477477
struct maple_tree mm_mt;
478-
u64 vmacache_seqnum; /* per-thread vmacache */
479478
#ifdef CONFIG_MMU
480479
unsigned long (*get_unmapped_area) (struct file *filp,
481480
unsigned long addr, unsigned long len,

include/linux/mm_types_task.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,6 @@
2424
IS_ENABLED(CONFIG_ARCH_ENABLE_SPLIT_PMD_PTLOCK))
2525
#define ALLOC_SPLIT_PTLOCKS (SPINLOCK_SIZE > BITS_PER_LONG/8)
2626

27-
/*
28-
* The per task VMA cache array:
29-
*/
30-
#define VMACACHE_BITS 2
31-
#define VMACACHE_SIZE (1U << VMACACHE_BITS)
32-
#define VMACACHE_MASK (VMACACHE_SIZE - 1)
33-
34-
struct vmacache {
35-
u64 seqnum;
36-
struct vm_area_struct *vmas[VMACACHE_SIZE];
37-
};
38-
3927
/*
4028
* When updating this, please also update struct resident_page_types[] in
4129
* kernel/fork.c

include/linux/sched.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -861,7 +861,6 @@ struct task_struct {
861861
struct mm_struct *active_mm;
862862

863863
/* Per-thread vma caching: */
864-
struct vmacache vmacache;
865864

866865
#ifdef SPLIT_RSS_COUNTING
867866
struct task_rss_stat rss_stat;

include/linux/vm_event_item.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,6 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
129129
NR_TLB_LOCAL_FLUSH_ALL,
130130
NR_TLB_LOCAL_FLUSH_ONE,
131131
#endif /* CONFIG_DEBUG_TLBFLUSH */
132-
#ifdef CONFIG_DEBUG_VM_VMACACHE
133-
VMACACHE_FIND_CALLS,
134-
VMACACHE_FIND_HITS,
135-
#endif
136132
#ifdef CONFIG_SWAP
137133
SWAP_RA,
138134
SWAP_RA_HIT,

include/linux/vmacache.h

Lines changed: 0 additions & 28 deletions
This file was deleted.

include/linux/vmstat.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,6 @@ static inline void vm_events_fold_cpu(int cpu)
125125
#define count_vm_tlb_events(x, y) do { (void)(y); } while (0)
126126
#endif
127127

128-
#ifdef CONFIG_DEBUG_VM_VMACACHE
129-
#define count_vm_vmacache_event(x) count_vm_event(x)
130-
#else
131-
#define count_vm_vmacache_event(x) do {} while (0)
132-
#endif
133-
134128
#define __count_zid_vm_events(item, zid, delta) \
135129
__count_vm_events(item##_NORMAL - ZONE_NORMAL + zid, delta)
136130

kernel/debug/debug_core.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
#include <linux/pid.h>
5151
#include <linux/smp.h>
5252
#include <linux/mm.h>
53-
#include <linux/vmacache.h>
5453
#include <linux/rcupdate.h>
5554
#include <linux/irq.h>
5655
#include <linux/security.h>
@@ -283,17 +282,6 @@ static void kgdb_flush_swbreak_addr(unsigned long addr)
283282
if (!CACHE_FLUSH_IS_SAFE)
284283
return;
285284

286-
if (current->mm) {
287-
int i;
288-
289-
for (i = 0; i < VMACACHE_SIZE; i++) {
290-
if (!current->vmacache.vmas[i])
291-
continue;
292-
flush_cache_range(current->vmacache.vmas[i],
293-
addr, addr + BREAK_INSTR_SIZE);
294-
}
295-
}
296-
297285
/* Force flush instruction cache if it was outside the mm */
298286
flush_icache_range(addr, addr + BREAK_INSTR_SIZE);
299287
}

kernel/fork.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
#include <linux/fs.h>
4444
#include <linux/mm.h>
4545
#include <linux/mm_inline.h>
46-
#include <linux/vmacache.h>
4746
#include <linux/nsproxy.h>
4847
#include <linux/capability.h>
4948
#include <linux/cpu.h>
@@ -1128,7 +1127,6 @@ static struct mm_struct *mm_init(struct mm_struct *mm, struct task_struct *p,
11281127
mm->mmap = NULL;
11291128
mt_init_flags(&mm->mm_mt, MM_MT_FLAGS);
11301129
mt_set_external_lock(&mm->mm_mt, &mm->mmap_lock);
1131-
mm->vmacache_seqnum = 0;
11321130
atomic_set(&mm->mm_users, 1);
11331131
atomic_set(&mm->mm_count, 1);
11341132
seqcount_init(&mm->write_protect_seq);
@@ -1585,9 +1583,6 @@ static int copy_mm(unsigned long clone_flags, struct task_struct *tsk)
15851583
if (!oldmm)
15861584
return 0;
15871585

1588-
/* initialize the new vmacache entries */
1589-
vmacache_flush(tsk);
1590-
15911586
if (clone_flags & CLONE_VM) {
15921587
mmget(oldmm);
15931588
mm = oldmm;

0 commit comments

Comments
 (0)