This source file includes following definitions.
- ksm_fork
- ksm_exit
- ksm_fork
- ksm_exit
- ksm_madvise
- ksm_might_need_to_copy
- rmap_walk_ksm
- ksm_migrate_page
- reuse_ksm_page
1
2 #ifndef __LINUX_KSM_H
3 #define __LINUX_KSM_H
4
5
6
7
8
9
10
11 #include <linux/bitops.h>
12 #include <linux/mm.h>
13 #include <linux/pagemap.h>
14 #include <linux/rmap.h>
15 #include <linux/sched.h>
16 #include <linux/sched/coredump.h>
17
18 struct stable_node;
19 struct mem_cgroup;
20
21 #ifdef CONFIG_KSM
22 int ksm_madvise(struct vm_area_struct *vma, unsigned long start,
23 unsigned long end, int advice, unsigned long *vm_flags);
24 int __ksm_enter(struct mm_struct *mm);
25 void __ksm_exit(struct mm_struct *mm);
26
27 static inline int ksm_fork(struct mm_struct *mm, struct mm_struct *oldmm)
28 {
29 if (test_bit(MMF_VM_MERGEABLE, &oldmm->flags))
30 return __ksm_enter(mm);
31 return 0;
32 }
33
34 static inline void ksm_exit(struct mm_struct *mm)
35 {
36 if (test_bit(MMF_VM_MERGEABLE, &mm->flags))
37 __ksm_exit(mm);
38 }
39
40
41
42
43
44
45
46
47
48
49
50
51 struct page *ksm_might_need_to_copy(struct page *page,
52 struct vm_area_struct *vma, unsigned long address);
53
54 void rmap_walk_ksm(struct page *page, struct rmap_walk_control *rwc);
55 void ksm_migrate_page(struct page *newpage, struct page *oldpage);
56 bool reuse_ksm_page(struct page *page,
57 struct vm_area_struct *vma, unsigned long address);
58
59 #else
60
61 static inline int ksm_fork(struct mm_struct *mm, struct mm_struct *oldmm)
62 {
63 return 0;
64 }
65
66 static inline void ksm_exit(struct mm_struct *mm)
67 {
68 }
69
70 #ifdef CONFIG_MMU
71 static inline int ksm_madvise(struct vm_area_struct *vma, unsigned long start,
72 unsigned long end, int advice, unsigned long *vm_flags)
73 {
74 return 0;
75 }
76
77 static inline struct page *ksm_might_need_to_copy(struct page *page,
78 struct vm_area_struct *vma, unsigned long address)
79 {
80 return page;
81 }
82
83 static inline void rmap_walk_ksm(struct page *page,
84 struct rmap_walk_control *rwc)
85 {
86 }
87
88 static inline void ksm_migrate_page(struct page *newpage, struct page *oldpage)
89 {
90 }
91 static inline bool reuse_ksm_page(struct page *page,
92 struct vm_area_struct *vma, unsigned long address)
93 {
94 return false;
95 }
96 #endif
97 #endif
98
99 #endif