Lines Matching full:vp

108  * @vp: The vma_prepare struct
114 static void init_multi_vma_prep(struct vma_prepare *vp, in init_multi_vma_prep() argument
120 memset(vp, 0, sizeof(struct vma_prepare)); in init_multi_vma_prep()
121 vp->vma = vma; in init_multi_vma_prep()
122 vp->anon_vma = vma->anon_vma; in init_multi_vma_prep()
123 vp->remove = remove; in init_multi_vma_prep()
124 vp->remove2 = remove2; in init_multi_vma_prep()
125 vp->adj_next = next; in init_multi_vma_prep()
126 if (!vp->anon_vma && next) in init_multi_vma_prep()
127 vp->anon_vma = next->anon_vma; in init_multi_vma_prep()
129 vp->file = vma->vm_file; in init_multi_vma_prep()
130 if (vp->file) in init_multi_vma_prep()
131 vp->mapping = vma->vm_file->f_mapping; in init_multi_vma_prep()
207 * @vp: The initialized vma_prepare struct
209 static void vma_prepare(struct vma_prepare *vp) in vma_prepare() argument
211 if (vp->file) { in vma_prepare()
212 uprobe_munmap(vp->vma, vp->vma->vm_start, vp->vma->vm_end); in vma_prepare()
214 if (vp->adj_next) in vma_prepare()
215 uprobe_munmap(vp->adj_next, vp->adj_next->vm_start, in vma_prepare()
216 vp->adj_next->vm_end); in vma_prepare()
218 i_mmap_lock_write(vp->mapping); in vma_prepare()
219 if (vp->insert && vp->insert->vm_file) { in vma_prepare()
226 __vma_link_file(vp->insert, in vma_prepare()
227 vp->insert->vm_file->f_mapping); in vma_prepare()
231 if (vp->anon_vma) { in vma_prepare()
232 anon_vma_lock_write(vp->anon_vma); in vma_prepare()
233 anon_vma_interval_tree_pre_update_vma(vp->vma); in vma_prepare()
234 if (vp->adj_next) in vma_prepare()
235 anon_vma_interval_tree_pre_update_vma(vp->adj_next); in vma_prepare()
238 if (vp->file) { in vma_prepare()
239 flush_dcache_mmap_lock(vp->mapping); in vma_prepare()
240 vma_interval_tree_remove(vp->vma, &vp->mapping->i_mmap); in vma_prepare()
241 if (vp->adj_next) in vma_prepare()
242 vma_interval_tree_remove(vp->adj_next, in vma_prepare()
243 &vp->mapping->i_mmap); in vma_prepare()
252 * @vp: The vma_prepare struct
256 static void vma_complete(struct vma_prepare *vp, struct vma_iterator *vmi, in vma_complete() argument
259 if (vp->file) { in vma_complete()
260 if (vp->adj_next) in vma_complete()
261 vma_interval_tree_insert(vp->adj_next, in vma_complete()
262 &vp->mapping->i_mmap); in vma_complete()
263 vma_interval_tree_insert(vp->vma, &vp->mapping->i_mmap); in vma_complete()
264 flush_dcache_mmap_unlock(vp->mapping); in vma_complete()
267 if (vp->remove && vp->file) { in vma_complete()
268 __remove_shared_vm_struct(vp->remove, vp->mapping); in vma_complete()
269 if (vp->remove2) in vma_complete()
270 __remove_shared_vm_struct(vp->remove2, vp->mapping); in vma_complete()
271 } else if (vp->insert) { in vma_complete()
277 vma_iter_store(vmi, vp->insert); in vma_complete()
281 if (vp->anon_vma) { in vma_complete()
282 anon_vma_interval_tree_post_update_vma(vp->vma); in vma_complete()
283 if (vp->adj_next) in vma_complete()
284 anon_vma_interval_tree_post_update_vma(vp->adj_next); in vma_complete()
285 anon_vma_unlock_write(vp->anon_vma); in vma_complete()
288 if (vp->file) { in vma_complete()
289 i_mmap_unlock_write(vp->mapping); in vma_complete()
290 uprobe_mmap(vp->vma); in vma_complete()
292 if (vp->adj_next) in vma_complete()
293 uprobe_mmap(vp->adj_next); in vma_complete()
296 if (vp->remove) { in vma_complete()
298 vma_mark_detached(vp->remove, true); in vma_complete()
299 if (vp->file) { in vma_complete()
300 uprobe_munmap(vp->remove, vp->remove->vm_start, in vma_complete()
301 vp->remove->vm_end); in vma_complete()
302 fput(vp->file); in vma_complete()
304 if (vp->remove->anon_vma) in vma_complete()
305 anon_vma_merge(vp->vma, vp->remove); in vma_complete()
307 mpol_put(vma_policy(vp->remove)); in vma_complete()
308 if (!vp->remove2) in vma_complete()
309 WARN_ON_ONCE(vp->vma->vm_end < vp->remove->vm_end); in vma_complete()
310 vm_area_free(vp->remove); in vma_complete()
316 if (vp->remove2) { in vma_complete()
317 vp->remove = vp->remove2; in vma_complete()
318 vp->remove2 = NULL; in vma_complete()
322 if (vp->insert && vp->file) in vma_complete()
323 uprobe_mmap(vp->insert); in vma_complete()
328 * @vp: The vma_prepare struct
331 static void init_vma_prep(struct vma_prepare *vp, struct vm_area_struct *vma) in init_vma_prep() argument
333 init_multi_vma_prep(vp, vma, NULL, NULL, NULL); in init_vma_prep()
421 struct vma_prepare vp; in __split_vma() local
467 init_vma_prep(&vp, vma); in __split_vma()
468 vp.insert = new; in __split_vma()
469 vma_prepare(&vp); in __split_vma()
480 vma_complete(&vp, vmi, vma->vm_mm); in __split_vma()
640 struct vma_prepare vp; in commit_merge() local
642 init_multi_vma_prep(&vp, vmg->vma, adjust, remove, remove2); in commit_merge()
644 VM_WARN_ON(vp.anon_vma && adjust && adjust->anon_vma && in commit_merge()
645 vp.anon_vma != adjust->anon_vma); in commit_merge()
658 vma_prepare(&vp); in commit_merge()
674 vma_complete(&vp, vmg->vmi, vmg->vma->vm_mm); in commit_merge()
1095 struct vma_prepare vp; in vma_shrink() local
1109 init_vma_prep(&vp, vma); in vma_shrink()
1110 vma_prepare(&vp); in vma_shrink()
1115 vma_complete(&vp, vmi, vma->vm_mm); in vma_shrink()