vma.c (17f1ae9b40c6b03760ca937c53e7f0d38c2613a2) vma.c (89b2d2a57eb97eec2e782976844995f4dd189998)
1// SPDX-License-Identifier: GPL-2.0-or-later
2
3/*
4 * VMA-specific functions.
5 */
6
7#include "vma_internal.h"
8#include "vma.h"

--- 255 unchanged lines hidden (view full) ---

264 vma->vm_start = addr;
265 vma->vm_pgoff += (addr - new->vm_start) >> PAGE_SHIFT;
266 } else {
267 vma->vm_end = addr;
268 }
269
270 /* vma_complete stores the new vma */
271 vma_complete(&vp, vmi, vma->vm_mm);
1// SPDX-License-Identifier: GPL-2.0-or-later
2
3/*
4 * VMA-specific functions.
5 */
6
7#include "vma_internal.h"
8#include "vma.h"

--- 255 unchanged lines hidden (view full) ---

264 vma->vm_start = addr;
265 vma->vm_pgoff += (addr - new->vm_start) >> PAGE_SHIFT;
266 } else {
267 vma->vm_end = addr;
268 }
269
270 /* vma_complete stores the new vma */
271 vma_complete(&vp, vmi, vma->vm_mm);
272 validate_mm(vma->vm_mm);
272
273 /* Success. */
274 if (new_below)
275 vma_next(vmi);
276 else
277 vma_prev(vmi);
278
279 return 0;

--- 263 unchanged lines hidden (view full) ---

543 goto nomem;
544
545 vma_prepare(&vp);
546 vma_adjust_trans_huge(vma, start, end, 0);
547 vma_set_range(vma, start, end, pgoff);
548 vma_iter_store(vmi, vma);
549
550 vma_complete(&vp, vmi, vma->vm_mm);
273
274 /* Success. */
275 if (new_below)
276 vma_next(vmi);
277 else
278 vma_prev(vmi);
279
280 return 0;

--- 263 unchanged lines hidden (view full) ---

544 goto nomem;
545
546 vma_prepare(&vp);
547 vma_adjust_trans_huge(vma, start, end, 0);
548 vma_set_range(vma, start, end, pgoff);
549 vma_iter_store(vmi, vma);
550
551 vma_complete(&vp, vmi, vma->vm_mm);
552 validate_mm(vma->vm_mm);
551 return 0;
552
553nomem:
554 if (anon_dup)
555 unlink_anon_vmas(anon_dup);
556 return -ENOMEM;
557}
558

--- 25 unchanged lines hidden (view full) ---

584
585 init_vma_prep(&vp, vma);
586 vma_prepare(&vp);
587 vma_adjust_trans_huge(vma, start, end, 0);
588
589 vma_iter_clear(vmi);
590 vma_set_range(vma, start, end, pgoff);
591 vma_complete(&vp, vmi, vma->vm_mm);
553 return 0;
554
555nomem:
556 if (anon_dup)
557 unlink_anon_vmas(anon_dup);
558 return -ENOMEM;
559}
560

--- 25 unchanged lines hidden (view full) ---

586
587 init_vma_prep(&vp, vma);
588 vma_prepare(&vp);
589 vma_adjust_trans_huge(vma, start, end, 0);
590
591 vma_iter_clear(vmi);
592 vma_set_range(vma, start, end, pgoff);
593 vma_complete(&vp, vmi, vma->vm_mm);
594 validate_mm(vma->vm_mm);
592 return 0;
593}
594
595/*
596 * vma_complete- Helper function for handling the unlocking after altering VMAs,
597 * or for inserting a VMA.
598 *
599 * @vp: The vma_prepare struct

--- 63 unchanged lines hidden (view full) ---

663 if (vp->remove2) {
664 vp->remove = vp->remove2;
665 vp->remove2 = NULL;
666 goto again;
667 }
668 }
669 if (vp->insert && vp->file)
670 uprobe_mmap(vp->insert);
595 return 0;
596}
597
598/*
599 * vma_complete- Helper function for handling the unlocking after altering VMAs,
600 * or for inserting a VMA.
601 *
602 * @vp: The vma_prepare struct

--- 63 unchanged lines hidden (view full) ---

666 if (vp->remove2) {
667 vp->remove = vp->remove2;
668 vp->remove2 = NULL;
669 goto again;
670 }
671 }
672 if (vp->insert && vp->file)
673 uprobe_mmap(vp->insert);
671 validate_mm(mm);
672}
673
674/*
675 * abort_munmap_vmas - Undo any munmap work and free resources
676 *
677 * Reattach any detached vmas and free up the maple tree used to track the vmas.
678 */
679static inline void abort_munmap_vmas(struct ma_state *mas_detach)

--- 512 unchanged lines hidden (view full) ---

1192 adjust->vm_pgoff += adj_start >> PAGE_SHIFT;
1193 if (adj_start < 0) {
1194 WARN_ON(vma_expanded);
1195 vma_iter_store(vmi, next);
1196 }
1197 }
1198
1199 vma_complete(&vp, vmi, mm);
674}
675
676/*
677 * abort_munmap_vmas - Undo any munmap work and free resources
678 *
679 * Reattach any detached vmas and free up the maple tree used to track the vmas.
680 */
681static inline void abort_munmap_vmas(struct ma_state *mas_detach)

--- 512 unchanged lines hidden (view full) ---

1194 adjust->vm_pgoff += adj_start >> PAGE_SHIFT;
1195 if (adj_start < 0) {
1196 WARN_ON(vma_expanded);
1197 vma_iter_store(vmi, next);
1198 }
1199 }
1200
1201 vma_complete(&vp, vmi, mm);
1202 validate_mm(mm);
1200 khugepaged_enter_vma(res, vm_flags);
1201 return res;
1202
1203prealloc_fail:
1204 if (anon_dup)
1205 unlink_anon_vmas(anon_dup);
1206
1207anon_vma_fail:

--- 645 unchanged lines hidden ---
1203 khugepaged_enter_vma(res, vm_flags);
1204 return res;
1205
1206prealloc_fail:
1207 if (anon_dup)
1208 unlink_anon_vmas(anon_dup);
1209
1210anon_vma_fail:

--- 645 unchanged lines hidden ---