Lines Matching refs:vma
45 static long madvise_behavior(struct vm_area_struct *vma, in madvise_behavior() argument
49 struct mm_struct *mm = vma->vm_mm; in madvise_behavior()
52 unsigned long new_flags = vma->vm_flags; in madvise_behavior()
68 if (vma->vm_flags & VM_IO) { in madvise_behavior()
86 error = ksm_madvise(vma, start, end, behavior, &new_flags); in madvise_behavior()
92 error = hugepage_madvise(vma, &new_flags, behavior); in madvise_behavior()
98 if (new_flags == vma->vm_flags) { in madvise_behavior()
99 *prev = vma; in madvise_behavior()
103 pgoff = vma->vm_pgoff + ((start - vma->vm_start) >> PAGE_SHIFT); in madvise_behavior()
104 *prev = vma_merge(mm, *prev, start, end, new_flags, vma->anon_vma, in madvise_behavior()
105 vma->vm_file, pgoff, vma_policy(vma)); in madvise_behavior()
107 vma = *prev; in madvise_behavior()
111 *prev = vma; in madvise_behavior()
113 if (start != vma->vm_start) { in madvise_behavior()
114 error = split_vma(mm, vma, start, 1); in madvise_behavior()
119 if (end != vma->vm_end) { in madvise_behavior()
120 error = split_vma(mm, vma, end, 0); in madvise_behavior()
129 vma->vm_flags = new_flags; in madvise_behavior()
142 struct vm_area_struct *vma = walk->private; in swapin_walk_pmd_entry() local
154 orig_pte = pte_offset_map_lock(vma->vm_mm, pmd, start, &ptl); in swapin_walk_pmd_entry()
165 vma, index); in swapin_walk_pmd_entry()
173 static void force_swapin_readahead(struct vm_area_struct *vma, in force_swapin_readahead() argument
177 .mm = vma->vm_mm, in force_swapin_readahead()
179 .private = vma, in force_swapin_readahead()
187 static void force_shm_swapin_readahead(struct vm_area_struct *vma, in force_shm_swapin_readahead() argument
196 index = ((start - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff; in force_shm_swapin_readahead()
218 static long madvise_willneed(struct vm_area_struct *vma, in madvise_willneed() argument
222 struct file *file = vma->vm_file; in madvise_willneed()
226 *prev = vma; in madvise_willneed()
227 force_swapin_readahead(vma, start, end); in madvise_willneed()
232 *prev = vma; in madvise_willneed()
233 force_shm_swapin_readahead(vma, start, end, in madvise_willneed()
247 *prev = vma; in madvise_willneed()
248 start = ((start - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff; in madvise_willneed()
249 if (end > vma->vm_end) in madvise_willneed()
250 end = vma->vm_end; in madvise_willneed()
251 end = ((end - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff; in madvise_willneed()
276 static long madvise_dontneed(struct vm_area_struct *vma, in madvise_dontneed() argument
280 *prev = vma; in madvise_dontneed()
281 if (vma->vm_flags & (VM_LOCKED|VM_HUGETLB|VM_PFNMAP)) in madvise_dontneed()
284 zap_page_range(vma, start, end - start, NULL); in madvise_dontneed()
292 static long madvise_remove(struct vm_area_struct *vma, in madvise_remove() argument
302 if (vma->vm_flags & (VM_LOCKED | VM_HUGETLB)) in madvise_remove()
305 f = vma->vm_file; in madvise_remove()
311 if ((vma->vm_flags & (VM_SHARED|VM_WRITE)) != (VM_SHARED|VM_WRITE)) in madvise_remove()
314 offset = (loff_t)(start - vma->vm_start) in madvise_remove()
315 + ((loff_t)vma->vm_pgoff << PAGE_SHIFT); in madvise_remove()
372 madvise_vma(struct vm_area_struct *vma, struct vm_area_struct **prev, in madvise_vma() argument
377 return madvise_remove(vma, prev, start, end); in madvise_vma()
379 return madvise_willneed(vma, prev, start, end); in madvise_vma()
381 return madvise_dontneed(vma, prev, start, end); in madvise_vma()
383 return madvise_behavior(vma, prev, start, end, behavior); in madvise_vma()
461 struct vm_area_struct *vma, *prev; in SYSCALL_DEFINE3() local
502 vma = find_vma_prev(current->mm, start, &prev); in SYSCALL_DEFINE3()
503 if (vma && start > vma->vm_start) in SYSCALL_DEFINE3()
504 prev = vma; in SYSCALL_DEFINE3()
510 if (!vma) in SYSCALL_DEFINE3()
514 if (start < vma->vm_start) { in SYSCALL_DEFINE3()
516 start = vma->vm_start; in SYSCALL_DEFINE3()
522 tmp = vma->vm_end; in SYSCALL_DEFINE3()
527 error = madvise_vma(vma, &prev, start, tmp, behavior); in SYSCALL_DEFINE3()
537 vma = prev->vm_next; in SYSCALL_DEFINE3()
539 vma = find_vma(current->mm, start); in SYSCALL_DEFINE3()