Lines Matching refs:anon_vma
291 struct anon_vma *anon_vma = vma->anon_vma; in validate_mm() local
315 if (anon_vma) { in validate_mm()
316 anon_vma_lock_read(anon_vma); in validate_mm()
319 anon_vma_unlock_read(anon_vma); in validate_mm()
355 anon_vma_interval_tree_remove(avc, &avc->anon_vma->rb_root); in anon_vma_interval_tree_pre_update_vma()
364 anon_vma_interval_tree_insert(avc, &avc->anon_vma->rb_root); in anon_vma_interval_tree_post_update_vma()
434 vp->anon_vma = vma->anon_vma; in init_multi_vma_prep()
438 if (!vp->anon_vma && next) in init_multi_vma_prep()
439 vp->anon_vma = next->anon_vma; in init_multi_vma_prep()
485 if (vp->anon_vma) { in vma_prepare()
486 anon_vma_lock_write(vp->anon_vma); in vma_prepare()
536 if (vp->anon_vma) { in vma_complete()
540 anon_vma_unlock_write(vp->anon_vma); in vma_complete()
559 if (vp->remove->anon_vma) in vma_complete()
598 if (src->anon_vma && !dst->anon_vma) { in dup_anon_vma()
602 dst->anon_vma = src->anon_vma; in dup_anon_vma()
746 static inline bool is_mergeable_anon_vma(struct anon_vma *anon_vma1, in is_mergeable_anon_vma()
747 struct anon_vma *anon_vma2, struct vm_area_struct *vma) in is_mergeable_anon_vma()
774 struct anon_vma *anon_vma, struct file *file, in can_vma_merge_before() argument
779 is_mergeable_anon_vma(anon_vma, vma->anon_vma, vma)) { in can_vma_merge_before()
797 struct anon_vma *anon_vma, struct file *file, in can_vma_merge_after() argument
802 is_mergeable_anon_vma(anon_vma, vma->anon_vma, vma)) { in can_vma_merge_after()
866 struct anon_vma *anon_vma, struct file *file, in vma_merge() argument
907 && can_vma_merge_after(prev, vm_flags, anon_vma, file, in vma_merge()
916 can_vma_merge_before(next, vm_flags, anon_vma, file, pgoff+pglen, in vma_merge()
937 is_mergeable_anon_vma(prev->anon_vma, next->anon_vma, NULL)) { in vma_merge()
946 if (!next->anon_vma) in vma_merge()
1005 VM_WARN_ON(vp.anon_vma && adjust && adjust->anon_vma && in vma_merge()
1006 vp.anon_vma != adjust->anon_vma); in vma_merge()
1085 static struct anon_vma *reusable_anon_vma(struct vm_area_struct *old, struct vm_area_struct *a, str… in reusable_anon_vma()
1088 struct anon_vma *anon_vma = READ_ONCE(old->anon_vma); in reusable_anon_vma() local
1090 if (anon_vma && list_is_singular(&old->anon_vma_chain)) in reusable_anon_vma()
1091 return anon_vma; in reusable_anon_vma()
1104 struct anon_vma *find_mergeable_anon_vma(struct vm_area_struct *vma) in find_mergeable_anon_vma()
1107 struct anon_vma *anon_vma = NULL; in find_mergeable_anon_vma() local
1113 anon_vma = reusable_anon_vma(next, vma, next); in find_mergeable_anon_vma()
1114 if (anon_vma) in find_mergeable_anon_vma()
1115 return anon_vma; in find_mergeable_anon_vma()
1123 anon_vma = reusable_anon_vma(prev, prev, vma); in find_mergeable_anon_vma()
1135 return anon_vma; in find_mergeable_anon_vma()
2003 anon_vma_lock_write(vma->anon_vma); in expand_upwards()
2040 anon_vma_unlock_write(vma->anon_vma); in expand_upwards()
2096 anon_vma_lock_write(vma->anon_vma); in expand_downwards()
2134 anon_vma_unlock_write(vma->anon_vma); in expand_downwards()
2726 (vma ? can_vma_merge_after(prev, vm_flags, vma->anon_vma, file, in mmap_region()
3296 BUG_ON(vma->anon_vma); in insert_vm_struct()
3327 if (unlikely(vma_is_anonymous(vma) && !vma->anon_vma)) { in copy_vma()
3337 vma->anon_vma, vma->vm_file, pgoff, vma_policy(vma), in copy_vma()
3599 static void vm_lock_anon_vma(struct mm_struct *mm, struct anon_vma *anon_vma) in vm_lock_anon_vma() argument
3601 if (!test_bit(0, (unsigned long *) &anon_vma->root->rb_root.rb_root.rb_node)) { in vm_lock_anon_vma()
3606 down_write_nest_lock(&anon_vma->root->rwsem, &mm->mmap_lock); in vm_lock_anon_vma()
3617 &anon_vma->root->rb_root.rb_root.rb_node)) in vm_lock_anon_vma()
3722 if (vma->anon_vma) in mm_take_all_locks()
3724 vm_lock_anon_vma(mm, avc->anon_vma); in mm_take_all_locks()
3734 static void vm_unlock_anon_vma(struct anon_vma *anon_vma) in vm_unlock_anon_vma() argument
3736 if (test_bit(0, (unsigned long *) &anon_vma->root->rb_root.rb_root.rb_node)) { in vm_unlock_anon_vma()
3750 &anon_vma->root->rb_root.rb_root.rb_node)) in vm_unlock_anon_vma()
3752 anon_vma_unlock_write(anon_vma); in vm_unlock_anon_vma()
3784 if (vma->anon_vma) in mm_drop_all_locks()
3786 vm_unlock_anon_vma(avc->anon_vma); in mm_drop_all_locks()