From: Liam R. Howlett Date: Mon, 14 Nov 2022 16:08:16 +0000 (-0500) Subject: mm: Remove unnecessary write to vma iterator in __vma_adjust() X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=1074cb7e3b69301356bd926ddafa744235aa156c;p=users%2Fjedix%2Flinux-maple.git mm: Remove unnecessary write to vma iterator in __vma_adjust() 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 --- diff --git a/mm/mmap.c b/mm/mmap.c index 9284b15906c1..5ba9b8a4e640 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -781,10 +781,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; }