Lines Matching refs:vma

13     struct vm_area_struct *vma = (struct vm_area_struct *)kmalloc(sizeof(struct vm_area_struct), 0);  in vm_area_alloc()  local
14 if (vma) in vm_area_alloc()
15 vma_init(vma, mm); in vm_area_alloc()
16 return vma; in vm_area_alloc()
24 void vm_area_del(struct vm_area_struct *vma) in vm_area_del() argument
26 if (vma->vm_mm == NULL) in vm_area_del()
28 __vma_unlink_list(vma->vm_mm, vma); in vm_area_del()
36 void vm_area_free(struct vm_area_struct *vma) in vm_area_free() argument
38 if (vma->vm_prev == NULL && vma->vm_next == NULL) // 如果当前是剩余的最后一个vma in vm_area_free()
39 vma->vm_mm->vmas = NULL; in vm_area_free()
40 kfree(vma); in vm_area_free()
50 void __vma_link_list(struct mm_struct *mm, struct vm_area_struct *vma, struct vm_area_struct *prev) in __vma_link_list() argument
53 vma->vm_prev = prev; in __vma_link_list()
57 prev->vm_next = vma; in __vma_link_list()
62 mm->vmas = vma; in __vma_link_list()
65 vma->vm_next = next; in __vma_link_list()
68 next->vm_prev = vma; in __vma_link_list()
77 void __vma_unlink_list(struct mm_struct *mm, struct vm_area_struct *vma) in __vma_unlink_list() argument
80 next = vma->vm_next; in __vma_unlink_list()
81 prev = vma->vm_prev; in __vma_unlink_list()
100 struct vm_area_struct *vma = mm->vmas; in vma_find() local
102 while (vma != NULL) in vma_find()
104 if (vma->vm_end > addr) in vma_find()
106 result = vma; in vma_find()
109 vma = vma->vm_next; in vma_find()
121 int vma_insert(struct mm_struct *mm, struct vm_area_struct *vma) in vma_insert() argument
126 prev = vma_find(mm, vma->vm_start); in vma_insert()
128 if (prev && prev->vm_start <= vma->vm_start && prev->vm_end >= vma->vm_end) in vma_insert()
134 …if (prev && ((vma->vm_start >= prev->vm_start && vma->vm_start <= prev->vm_end) || (prev->vm_start… in vma_insert()
137 …if ((!CROSS_2M_BOUND(vma->vm_start, prev->vm_start)) && (!CROSS_2M_BOUND(vma->vm_end, prev->vm_end… in vma_insert()
140 … kdebug("before combining vma:vm_start = %#018lx, vm_end = %#018lx\n", vma->vm_start, vma->vm_end); in vma_insert()
142 prev->vm_start = (vma->vm_start < prev->vm_start )? vma->vm_start : prev->vm_start; in vma_insert()
143 prev->vm_end = (vma->vm_end > prev->vm_end) ? vma->vm_end : prev->vm_end; in vma_insert()
146 …8lx, vm_end = %#018lx\nprev:vm_start = %018lx, vm_end = %018lx\n", vma->vm_start, vma->vm_end, pre… in vma_insert()
170 __vma_link_list(mm, vma, prev); in vma_insert()
217 int __anon_vma_add(struct anon_vma_t *anon_vma, struct vm_area_struct *vma) in __anon_vma_add() argument
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()
252 int __anon_vma_del(struct vm_area_struct *vma) in __anon_vma_del() argument
255 if (vma->anon_vma == NULL) in __anon_vma_del()
258 list_del(&vma->anon_vma_list); 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()
274 list_init(&vma->anon_vma_list); in __anon_vma_del()