diff options
Diffstat (limited to 'include/linux/rmap.h')
-rw-r--r-- | include/linux/rmap.h | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/include/linux/rmap.h b/include/linux/rmap.h index cb0ba7032609..b019ae64e2ab 100644 --- a/include/linux/rmap.h +++ b/include/linux/rmap.h | |||
@@ -26,6 +26,9 @@ | |||
26 | */ | 26 | */ |
27 | struct anon_vma { | 27 | struct anon_vma { |
28 | spinlock_t lock; /* Serialize access to vma list */ | 28 | spinlock_t lock; /* Serialize access to vma list */ |
29 | #ifdef CONFIG_KSM | ||
30 | atomic_t ksm_refcount; | ||
31 | #endif | ||
29 | /* | 32 | /* |
30 | * NOTE: the LSB of the head.next is set by | 33 | * NOTE: the LSB of the head.next is set by |
31 | * mm_take_all_locks() _after_ taking the above lock. So the | 34 | * mm_take_all_locks() _after_ taking the above lock. So the |
@@ -38,6 +41,34 @@ struct anon_vma { | |||
38 | }; | 41 | }; |
39 | 42 | ||
40 | #ifdef CONFIG_MMU | 43 | #ifdef CONFIG_MMU |
44 | #ifdef CONFIG_KSM | ||
45 | static inline void ksm_refcount_init(struct anon_vma *anon_vma) | ||
46 | { | ||
47 | atomic_set(&anon_vma->ksm_refcount, 0); | ||
48 | } | ||
49 | |||
50 | static inline int ksm_refcount(struct anon_vma *anon_vma) | ||
51 | { | ||
52 | return atomic_read(&anon_vma->ksm_refcount); | ||
53 | } | ||
54 | #else | ||
55 | static inline void ksm_refcount_init(struct anon_vma *anon_vma) | ||
56 | { | ||
57 | } | ||
58 | |||
59 | static inline int ksm_refcount(struct anon_vma *anon_vma) | ||
60 | { | ||
61 | return 0; | ||
62 | } | ||
63 | #endif /* CONFIG_KSM */ | ||
64 | |||
65 | static inline struct anon_vma *page_anon_vma(struct page *page) | ||
66 | { | ||
67 | if (((unsigned long)page->mapping & PAGE_MAPPING_FLAGS) != | ||
68 | PAGE_MAPPING_ANON) | ||
69 | return NULL; | ||
70 | return page_rmapping(page); | ||
71 | } | ||
41 | 72 | ||
42 | static inline void anon_vma_lock(struct vm_area_struct *vma) | 73 | static inline void anon_vma_lock(struct vm_area_struct *vma) |
43 | { | 74 | { |
@@ -62,6 +93,7 @@ void __anon_vma_merge(struct vm_area_struct *, struct vm_area_struct *); | |||
62 | void anon_vma_unlink(struct vm_area_struct *); | 93 | void anon_vma_unlink(struct vm_area_struct *); |
63 | void anon_vma_link(struct vm_area_struct *); | 94 | void anon_vma_link(struct vm_area_struct *); |
64 | void __anon_vma_link(struct vm_area_struct *); | 95 | void __anon_vma_link(struct vm_area_struct *); |
96 | void anon_vma_free(struct anon_vma *); | ||
65 | 97 | ||
66 | /* | 98 | /* |
67 | * rmap interfaces called when adding or removing pte of page | 99 | * rmap interfaces called when adding or removing pte of page |
@@ -81,6 +113,9 @@ static inline void page_dup_rmap(struct page *page) | |||
81 | */ | 113 | */ |
82 | int page_referenced(struct page *, int is_locked, | 114 | int page_referenced(struct page *, int is_locked, |
83 | struct mem_cgroup *cnt, unsigned long *vm_flags); | 115 | struct mem_cgroup *cnt, unsigned long *vm_flags); |
116 | int page_referenced_one(struct page *, struct vm_area_struct *, | ||
117 | unsigned long address, unsigned int *mapcount, unsigned long *vm_flags); | ||
118 | |||
84 | enum ttu_flags { | 119 | enum ttu_flags { |
85 | TTU_UNMAP = 0, /* unmap mode */ | 120 | TTU_UNMAP = 0, /* unmap mode */ |
86 | TTU_MIGRATION = 1, /* migration mode */ | 121 | TTU_MIGRATION = 1, /* migration mode */ |
@@ -94,6 +129,8 @@ enum ttu_flags { | |||
94 | #define TTU_ACTION(x) ((x) & TTU_ACTION_MASK) | 129 | #define TTU_ACTION(x) ((x) & TTU_ACTION_MASK) |
95 | 130 | ||
96 | int try_to_unmap(struct page *, enum ttu_flags flags); | 131 | int try_to_unmap(struct page *, enum ttu_flags flags); |
132 | int try_to_unmap_one(struct page *, struct vm_area_struct *, | ||
133 | unsigned long address, enum ttu_flags flags); | ||
97 | 134 | ||
98 | /* | 135 | /* |
99 | * Called from mm/filemap_xip.c to unmap empty zero page | 136 | * Called from mm/filemap_xip.c to unmap empty zero page |
@@ -127,6 +164,12 @@ struct anon_vma *page_lock_anon_vma(struct page *page); | |||
127 | void page_unlock_anon_vma(struct anon_vma *anon_vma); | 164 | void page_unlock_anon_vma(struct anon_vma *anon_vma); |
128 | int page_mapped_in_vma(struct page *page, struct vm_area_struct *vma); | 165 | int page_mapped_in_vma(struct page *page, struct vm_area_struct *vma); |
129 | 166 | ||
167 | /* | ||
168 | * Called by migrate.c to remove migration ptes, but might be used more later. | ||
169 | */ | ||
170 | int rmap_walk(struct page *page, int (*rmap_one)(struct page *, | ||
171 | struct vm_area_struct *, unsigned long, void *), void *arg); | ||
172 | |||
130 | #else /* !CONFIG_MMU */ | 173 | #else /* !CONFIG_MMU */ |
131 | 174 | ||
132 | #define anon_vma_init() do {} while (0) | 175 | #define anon_vma_init() do {} while (0) |