summaryrefslogtreecommitdiff
path: root/mm/mmap.c
diff options
context:
space:
mode:
authorLiam R. Howlett <Liam.Howlett@Oracle.com>2023-01-20 11:26:35 -0500
committerAndrew Morton <akpm@linux-foundation.org>2023-02-09 16:51:36 -0800
commitc465be97a4bc0022688d99f77a75b9be91843b31 (patch)
tree23ba7cea180c7b4b95e72bbba3da5b37d290bf1e /mm/mmap.c
parent85ab779e3426dc47cc27418821e6577680b509b9 (diff)
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. Link: https://lkml.kernel.org/r/20230120162650.984577-35-Liam.Howlett@oracle.com Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm/mmap.c')
-rw-r--r--mm/mmap.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/mm/mmap.c b/mm/mmap.c
index 330de1ab6a8d..bd3ccfb4d9e0 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -719,10 +719,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;
}