aboutsummaryrefslogtreecommitdiffstats
path: root/mm/rmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/rmap.c')
-rw-r--r--mm/rmap.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/mm/rmap.c b/mm/rmap.c
index 869aaa3206a2..ebdf582ef185 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -68,7 +68,7 @@ static inline struct anon_vma *anon_vma_alloc(void)
68 return kmem_cache_alloc(anon_vma_cachep, GFP_KERNEL); 68 return kmem_cache_alloc(anon_vma_cachep, GFP_KERNEL);
69} 69}
70 70
71static inline void anon_vma_free(struct anon_vma *anon_vma) 71void anon_vma_free(struct anon_vma *anon_vma)
72{ 72{
73 kmem_cache_free(anon_vma_cachep, anon_vma); 73 kmem_cache_free(anon_vma_cachep, anon_vma);
74} 74}
@@ -172,7 +172,7 @@ void anon_vma_unlink(struct vm_area_struct *vma)
172 list_del(&vma->anon_vma_node); 172 list_del(&vma->anon_vma_node);
173 173
174 /* We must garbage collect the anon_vma if it's empty */ 174 /* We must garbage collect the anon_vma if it's empty */
175 empty = list_empty(&anon_vma->head); 175 empty = list_empty(&anon_vma->head) && !ksm_refcount(anon_vma);
176 spin_unlock(&anon_vma->lock); 176 spin_unlock(&anon_vma->lock);
177 177
178 if (empty) 178 if (empty)
@@ -184,6 +184,7 @@ static void anon_vma_ctor(void *data)
184 struct anon_vma *anon_vma = data; 184 struct anon_vma *anon_vma = data;
185 185
186 spin_lock_init(&anon_vma->lock); 186 spin_lock_init(&anon_vma->lock);
187 ksm_refcount_init(anon_vma);
187 INIT_LIST_HEAD(&anon_vma->head); 188 INIT_LIST_HEAD(&anon_vma->head);
188} 189}
189 190