]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm: Remove unnecessary write to vma iterator in __vma_adjust()
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Mon, 14 Nov 2022 16:08:16 +0000 (11:08 -0500)
committerLiam R. Howlett <Liam.Howlett@oracle.com>
Mon, 28 Nov 2022 21:00:12 +0000 (16:00 -0500)
If the vma start address is going to change due to an insert, then it is
safe to not write the vma to the tree.  The write of the insert vma will
alter the tree as necessary.

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
mm/mmap.c

index fcf61d2b1e1a63d17aa62c8b78ed982f4b296eaf..43e9a3fc5f3e68fc0af753b59277382c85ce7c43 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -779,10 +779,12 @@ int __vma_adjust(struct vma_iterator *vmi, struct vm_area_struct *vma,
        }
 
        if (start != vma->vm_start) {
-               if ((vma->vm_start < start) &&
-                   (!insert || (insert->vm_end != start))) {
-                       vma_iter_clear(vmi, vma->vm_start, start);
-                       VM_WARN_ON(insert && insert->vm_start > vma->vm_start);
+               if (vma->vm_start < start) {
+                       if (!insert || (insert->vm_end != start)) {
+                               vma_iter_clear(vmi, vma->vm_start, start);
+                               vma_iter_set(vmi, start);
+                               VM_WARN_ON(insert && insert->vm_start > vma->vm_start);
+                       }
                } else {
                        vma_changed = true;
                }