]>
Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
615d6e87 DB |
2 | #ifndef __LINUX_VMACACHE_H |
3 | #define __LINUX_VMACACHE_H | |
4 | ||
5 | #include <linux/sched.h> | |
6 | #include <linux/mm.h> | |
7 | ||
8 | /* | |
9 | * Hash based on the page number. Provides a good hit rate for | |
10 | * workloads with good locality and those with random accesses as well. | |
11 | */ | |
12 | #define VMACACHE_HASH(addr) ((addr >> PAGE_SHIFT) & VMACACHE_MASK) | |
13 | ||
14 | static inline void vmacache_flush(struct task_struct *tsk) | |
15 | { | |
314ff785 | 16 | memset(tsk->vmacache.vmas, 0, sizeof(tsk->vmacache.vmas)); |
615d6e87 DB |
17 | } |
18 | ||
615d6e87 DB |
19 | extern void vmacache_update(unsigned long addr, struct vm_area_struct *newvma); |
20 | extern struct vm_area_struct *vmacache_find(struct mm_struct *mm, | |
21 | unsigned long addr); | |
22 | ||
23 | #ifndef CONFIG_MMU | |
24 | extern struct vm_area_struct *vmacache_find_exact(struct mm_struct *mm, | |
25 | unsigned long start, | |
26 | unsigned long end); | |
27 | #endif | |
28 | ||
29 | static inline void vmacache_invalidate(struct mm_struct *mm) | |
30 | { | |
31 | mm->vmacache_seqnum++; | |
615d6e87 DB |
32 | } |
33 | ||
34 | #endif /* __LINUX_VMACACHE_H */ |