Lines Matching refs:vma
352 struct vm_area_struct *vma, struct zone *zone, in __munlock_pagevec_fill() argument
363 pte = get_locked_pte(vma->vm_mm, start, &ptl); in __munlock_pagevec_fill()
376 page = vm_normal_page(vma, start, *pte); in __munlock_pagevec_fill()
422 void munlock_vma_pages_range(struct vm_area_struct *vma, in munlock_vma_pages_range() argument
425 vma->vm_flags &= VM_LOCKED_CLEAR_MASK; in munlock_vma_pages_range()
442 page = follow_page(vma, start, FOLL_GET | FOLL_DUMP); in munlock_vma_pages_range()
474 start = __munlock_pagevec_fill(&pvec, vma, in munlock_vma_pages_range()
496 static int mlock_fixup(struct vm_area_struct *vma, struct vm_area_struct **prev, in mlock_fixup() argument
499 struct mm_struct *mm = vma->vm_mm; in mlock_fixup()
504 vm_flags_t old_flags = vma->vm_flags; in mlock_fixup()
506 if (newflags == vma->vm_flags || (vma->vm_flags & VM_SPECIAL) || in mlock_fixup()
507 is_vm_hugetlb_page(vma) || vma == get_gate_vma(current->mm) || in mlock_fixup()
508 vma_is_dax(vma) || vma_is_secretmem(vma)) in mlock_fixup()
512 pgoff = vma->vm_pgoff + ((start - vma->vm_start) >> PAGE_SHIFT); in mlock_fixup()
513 *prev = vma_merge(mm, *prev, start, end, newflags, vma->anon_vma, in mlock_fixup()
514 vma->vm_file, pgoff, vma_policy(vma), in mlock_fixup()
515 vma->vm_userfaultfd_ctx); in mlock_fixup()
517 vma = *prev; in mlock_fixup()
521 if (start != vma->vm_start) { in mlock_fixup()
522 ret = split_vma(mm, vma, start, 1); in mlock_fixup()
527 if (end != vma->vm_end) { in mlock_fixup()
528 ret = split_vma(mm, vma, end, 0); in mlock_fixup()
551 vma->vm_flags = newflags; in mlock_fixup()
553 munlock_vma_pages_range(vma, start, end); in mlock_fixup()
556 *prev = vma; in mlock_fixup()
564 struct vm_area_struct *vma, *prev; in apply_vma_lock_flags() local
574 vma = find_vma(current->mm, start); in apply_vma_lock_flags()
575 if (!vma || vma->vm_start > start) in apply_vma_lock_flags()
578 prev = vma->vm_prev; in apply_vma_lock_flags()
579 if (start > vma->vm_start) in apply_vma_lock_flags()
580 prev = vma; in apply_vma_lock_flags()
583 vm_flags_t newflags = vma->vm_flags & VM_LOCKED_CLEAR_MASK; in apply_vma_lock_flags()
588 tmp = vma->vm_end; in apply_vma_lock_flags()
591 error = mlock_fixup(vma, &prev, nstart, tmp, newflags); in apply_vma_lock_flags()
600 vma = prev->vm_next; in apply_vma_lock_flags()
601 if (!vma || vma->vm_start != nstart) { in apply_vma_lock_flags()
619 struct vm_area_struct *vma; in count_mm_mlocked_page_nr() local
625 vma = find_vma(mm, start); in count_mm_mlocked_page_nr()
626 if (vma == NULL) in count_mm_mlocked_page_nr()
629 for (; vma ; vma = vma->vm_next) { in count_mm_mlocked_page_nr()
630 if (start >= vma->vm_end) in count_mm_mlocked_page_nr()
632 if (start + len <= vma->vm_start) in count_mm_mlocked_page_nr()
634 if (vma->vm_flags & VM_LOCKED) { in count_mm_mlocked_page_nr()
635 if (start > vma->vm_start) in count_mm_mlocked_page_nr()
636 count -= (start - vma->vm_start); in count_mm_mlocked_page_nr()
637 if (start + len < vma->vm_end) { in count_mm_mlocked_page_nr()
638 count += start + len - vma->vm_start; in count_mm_mlocked_page_nr()
641 count += vma->vm_end - vma->vm_start; in count_mm_mlocked_page_nr()
742 struct vm_area_struct *vma, *prev = NULL; in apply_mlockall_flags() local
762 for (vma = current->mm->mmap; vma ; vma = prev->vm_next) { in apply_mlockall_flags()
765 newflags = vma->vm_flags & VM_LOCKED_CLEAR_MASK; in apply_mlockall_flags()
769 mlock_fixup(vma, &prev, vma->vm_start, vma->vm_end, newflags); in apply_mlockall_flags()