aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/rmap.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/rmap.h')
-rw-r--r--include/linux/rmap.h41
1 files changed, 37 insertions, 4 deletions
diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index 77216742c178..31b2fd75dcba 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -26,6 +26,7 @@
26 */ 26 */
27struct anon_vma { 27struct anon_vma {
28 spinlock_t lock; /* Serialize access to vma list */ 28 spinlock_t lock; /* Serialize access to vma list */
29 struct anon_vma *root; /* Root of this anon_vma tree */
29#if defined(CONFIG_KSM) || defined(CONFIG_MIGRATION) 30#if defined(CONFIG_KSM) || defined(CONFIG_MIGRATION)
30 31
31 /* 32 /*
@@ -80,6 +81,13 @@ static inline int anonvma_external_refcount(struct anon_vma *anon_vma)
80{ 81{
81 return atomic_read(&anon_vma->external_refcount); 82 return atomic_read(&anon_vma->external_refcount);
82} 83}
84
85static inline void get_anon_vma(struct anon_vma *anon_vma)
86{
87 atomic_inc(&anon_vma->external_refcount);
88}
89
90void drop_anon_vma(struct anon_vma *);
83#else 91#else
84static inline void anonvma_external_refcount_init(struct anon_vma *anon_vma) 92static inline void anonvma_external_refcount_init(struct anon_vma *anon_vma)
85{ 93{
@@ -89,6 +97,14 @@ static inline int anonvma_external_refcount(struct anon_vma *anon_vma)
89{ 97{
90 return 0; 98 return 0;
91} 99}
100
101static inline void get_anon_vma(struct anon_vma *anon_vma)
102{
103}
104
105static inline void drop_anon_vma(struct anon_vma *anon_vma)
106{
107}
92#endif /* CONFIG_KSM */ 108#endif /* CONFIG_KSM */
93 109
94static inline struct anon_vma *page_anon_vma(struct page *page) 110static inline struct anon_vma *page_anon_vma(struct page *page)
@@ -99,18 +115,28 @@ static inline struct anon_vma *page_anon_vma(struct page *page)
99 return page_rmapping(page); 115 return page_rmapping(page);
100} 116}
101 117
102static inline void anon_vma_lock(struct vm_area_struct *vma) 118static inline void vma_lock_anon_vma(struct vm_area_struct *vma)
103{ 119{
104 struct anon_vma *anon_vma = vma->anon_vma; 120 struct anon_vma *anon_vma = vma->anon_vma;
105 if (anon_vma) 121 if (anon_vma)
106 spin_lock(&anon_vma->lock); 122 spin_lock(&anon_vma->root->lock);
107} 123}
108 124
109static inline void anon_vma_unlock(struct vm_area_struct *vma) 125static inline void vma_unlock_anon_vma(struct vm_area_struct *vma)
110{ 126{
111 struct anon_vma *anon_vma = vma->anon_vma; 127 struct anon_vma *anon_vma = vma->anon_vma;
112 if (anon_vma) 128 if (anon_vma)
113 spin_unlock(&anon_vma->lock); 129 spin_unlock(&anon_vma->root->lock);
130}
131
132static inline void anon_vma_lock(struct anon_vma *anon_vma)
133{
134 spin_lock(&anon_vma->root->lock);
135}
136
137static inline void anon_vma_unlock(struct anon_vma *anon_vma)
138{
139 spin_unlock(&anon_vma->root->lock);
114} 140}
115 141
116/* 142/*
@@ -136,10 +162,17 @@ static inline void anon_vma_merge(struct vm_area_struct *vma,
136 */ 162 */
137void page_move_anon_rmap(struct page *, struct vm_area_struct *, unsigned long); 163void page_move_anon_rmap(struct page *, struct vm_area_struct *, unsigned long);
138void page_add_anon_rmap(struct page *, struct vm_area_struct *, unsigned long); 164void page_add_anon_rmap(struct page *, struct vm_area_struct *, unsigned long);
165void do_page_add_anon_rmap(struct page *, struct vm_area_struct *,
166 unsigned long, int);
139void page_add_new_anon_rmap(struct page *, struct vm_area_struct *, unsigned long); 167void page_add_new_anon_rmap(struct page *, struct vm_area_struct *, unsigned long);
140void page_add_file_rmap(struct page *); 168void page_add_file_rmap(struct page *);
141void page_remove_rmap(struct page *); 169void page_remove_rmap(struct page *);
142 170
171void hugepage_add_anon_rmap(struct page *, struct vm_area_struct *,
172 unsigned long);
173void hugepage_add_new_anon_rmap(struct page *, struct vm_area_struct *,
174 unsigned long);
175
143static inline void page_dup_rmap(struct page *page) 176static inline void page_dup_rmap(struct page *page)
144{ 177{
145 atomic_inc(&page->_mapcount); 178 atomic_inc(&page->_mapcount);