Lines Matching refs:anon_vma

184     struct anon_vma_t *anon_vma = (struct anon_vma_t *)kmalloc(sizeof(struct anon_vma_t), 0);  in __anon_vma_create_alloc()  local
185 if (unlikely(anon_vma == NULL)) in __anon_vma_create_alloc()
187 memset(anon_vma, 0, sizeof(struct anon_vma_t)); in __anon_vma_create_alloc()
189 list_init(&anon_vma->vma_list); in __anon_vma_create_alloc()
190 semaphore_init(&anon_vma->sem, 1); in __anon_vma_create_alloc()
199 page->anon_vma = anon_vma; in __anon_vma_create_alloc()
203 page->anon_vma = anon_vma; in __anon_vma_create_alloc()
205 anon_vma->page = page; in __anon_vma_create_alloc()
207 return anon_vma; in __anon_vma_create_alloc()
217 int __anon_vma_add(struct anon_vma_t *anon_vma, struct vm_area_struct *vma) in __anon_vma_add() argument
219 semaphore_down(&anon_vma->sem); in __anon_vma_add()
220 list_add(&anon_vma->vma_list, &vma->anon_vma_list); in __anon_vma_add()
221 vma->anon_vma = anon_vma; in __anon_vma_add()
222 atomic_inc(&anon_vma->ref_count); in __anon_vma_add()
223 semaphore_up(&anon_vma->sem); in __anon_vma_add()
233 int __anon_vma_free(struct anon_vma_t *anon_vma) in __anon_vma_free() argument
235 if (anon_vma->page != NULL) in __anon_vma_free()
237 spin_lock(&anon_vma->page->op_lock); in __anon_vma_free()
238 anon_vma->page->anon_vma = NULL; in __anon_vma_free()
239 spin_unlock(&anon_vma->page->op_lock); in __anon_vma_free()
241 kfree(anon_vma); in __anon_vma_free()
255 if (vma->anon_vma == NULL) in __anon_vma_del()
259 atomic_dec(&vma->anon_vma->ref_count); in __anon_vma_del()
262 if (unlikely(atomic_read(&vma->anon_vma->ref_count) == 0)) // 应当释放该anon_vma in __anon_vma_del()
265 if (vma->anon_vma->page->attr & PAGE_DEVICE) in __anon_vma_del()
266 kfree(vma->anon_vma->page); in __anon_vma_del()
268 free_pages(vma->anon_vma->page, 1); in __anon_vma_del()
269 __anon_vma_free(vma->anon_vma); in __anon_vma_del()
273 vma->anon_vma = NULL; in __anon_vma_del()