Lines Matching full:vp

57  * @vp: The vma_prepare struct
63 static void init_multi_vma_prep(struct vma_prepare *vp, in init_multi_vma_prep() argument
69 memset(vp, 0, sizeof(struct vma_prepare)); in init_multi_vma_prep()
70 vp->vma = vma; in init_multi_vma_prep()
71 vp->anon_vma = vma->anon_vma; in init_multi_vma_prep()
72 vp->remove = remove; in init_multi_vma_prep()
73 vp->remove2 = remove2; in init_multi_vma_prep()
74 vp->adj_next = next; in init_multi_vma_prep()
75 if (!vp->anon_vma && next) in init_multi_vma_prep()
76 vp->anon_vma = next->anon_vma; in init_multi_vma_prep()
78 vp->file = vma->vm_file; in init_multi_vma_prep()
79 if (vp->file) in init_multi_vma_prep()
80 vp->mapping = vma->vm_file->f_mapping; in init_multi_vma_prep()
156 * @vp: The initialized vma_prepare struct
158 static void vma_prepare(struct vma_prepare *vp) in vma_prepare() argument
160 if (vp->file) { in vma_prepare()
161 uprobe_munmap(vp->vma, vp->vma->vm_start, vp->vma->vm_end); in vma_prepare()
163 if (vp->adj_next) in vma_prepare()
164 uprobe_munmap(vp->adj_next, vp->adj_next->vm_start, in vma_prepare()
165 vp->adj_next->vm_end); in vma_prepare()
167 i_mmap_lock_write(vp->mapping); in vma_prepare()
168 if (vp->insert && vp->insert->vm_file) { in vma_prepare()
175 __vma_link_file(vp->insert, in vma_prepare()
176 vp->insert->vm_file->f_mapping); in vma_prepare()
180 if (vp->anon_vma) { in vma_prepare()
181 anon_vma_lock_write(vp->anon_vma); in vma_prepare()
182 anon_vma_interval_tree_pre_update_vma(vp->vma); in vma_prepare()
183 if (vp->adj_next) in vma_prepare()
184 anon_vma_interval_tree_pre_update_vma(vp->adj_next); in vma_prepare()
187 if (vp->file) { in vma_prepare()
188 flush_dcache_mmap_lock(vp->mapping); in vma_prepare()
189 vma_interval_tree_remove(vp->vma, &vp->mapping->i_mmap); in vma_prepare()
190 if (vp->adj_next) in vma_prepare()
191 vma_interval_tree_remove(vp->adj_next, in vma_prepare()
192 &vp->mapping->i_mmap); in vma_prepare()
201 * @vp: The vma_prepare struct
205 static void vma_complete(struct vma_prepare *vp, struct vma_iterator *vmi, in vma_complete() argument
208 if (vp->file) { in vma_complete()
209 if (vp->adj_next) in vma_complete()
210 vma_interval_tree_insert(vp->adj_next, in vma_complete()
211 &vp->mapping->i_mmap); in vma_complete()
212 vma_interval_tree_insert(vp->vma, &vp->mapping->i_mmap); in vma_complete()
213 flush_dcache_mmap_unlock(vp->mapping); in vma_complete()
216 if (vp->remove && vp->file) { in vma_complete()
217 __remove_shared_vm_struct(vp->remove, vp->mapping); in vma_complete()
218 if (vp->remove2) in vma_complete()
219 __remove_shared_vm_struct(vp->remove2, vp->mapping); in vma_complete()
220 } else if (vp->insert) { in vma_complete()
226 vma_iter_store(vmi, vp->insert); in vma_complete()
230 if (vp->anon_vma) { in vma_complete()
231 anon_vma_interval_tree_post_update_vma(vp->vma); in vma_complete()
232 if (vp->adj_next) in vma_complete()
233 anon_vma_interval_tree_post_update_vma(vp->adj_next); in vma_complete()
234 anon_vma_unlock_write(vp->anon_vma); in vma_complete()
237 if (vp->file) { in vma_complete()
238 i_mmap_unlock_write(vp->mapping); in vma_complete()
239 uprobe_mmap(vp->vma); in vma_complete()
241 if (vp->adj_next) in vma_complete()
242 uprobe_mmap(vp->adj_next); in vma_complete()
245 if (vp->remove) { in vma_complete()
247 vma_mark_detached(vp->remove, true); in vma_complete()
248 if (vp->file) { in vma_complete()
249 uprobe_munmap(vp->remove, vp->remove->vm_start, in vma_complete()
250 vp->remove->vm_end); in vma_complete()
251 fput(vp->file); in vma_complete()
253 if (vp->remove->anon_vma) in vma_complete()
254 anon_vma_merge(vp->vma, vp->remove); in vma_complete()
256 mpol_put(vma_policy(vp->remove)); in vma_complete()
257 if (!vp->remove2) in vma_complete()
258 WARN_ON_ONCE(vp->vma->vm_end < vp->remove->vm_end); in vma_complete()
259 vm_area_free(vp->remove); in vma_complete()
265 if (vp->remove2) { in vma_complete()
266 vp->remove = vp->remove2; in vma_complete()
267 vp->remove2 = NULL; in vma_complete()
271 if (vp->insert && vp->file) in vma_complete()
272 uprobe_mmap(vp->insert); in vma_complete()
277 * @vp: The vma_prepare struct
280 static void init_vma_prep(struct vma_prepare *vp, struct vm_area_struct *vma) in init_vma_prep() argument
282 init_multi_vma_prep(vp, vma, NULL, NULL, NULL); in init_vma_prep()
370 struct vma_prepare vp; in __split_vma() local
416 init_vma_prep(&vp, vma); in __split_vma()
417 vp.insert = new; in __split_vma()
418 vma_prepare(&vp); in __split_vma()
429 vma_complete(&vp, vmi, vma->vm_mm); in __split_vma()
585 struct vma_prepare vp; in commit_merge() local
587 init_multi_vma_prep(&vp, vmg->vma, adjust, remove, remove2); in commit_merge()
589 VM_WARN_ON(vp.anon_vma && adjust && adjust->anon_vma && in commit_merge()
590 vp.anon_vma != adjust->anon_vma); in commit_merge()
603 vma_prepare(&vp); in commit_merge()
619 vma_complete(&vp, vmg->vmi, vmg->vma->vm_mm); in commit_merge()
1054 struct vma_prepare vp; in vma_shrink() local
1068 init_vma_prep(&vp, vma); in vma_shrink()
1069 vma_prepare(&vp); in vma_shrink()
1074 vma_complete(&vp, vmi, vma->vm_mm); in vma_shrink()