[PATCH] mmap: Remove unroll from __vma_adjust()

Liam Howlett liam.howlett at oracle.com
Tue Jul 19 11:49:48 PDT 2022


If __vma_adjust() fails, then there is no reason to undo the anon vma
work since it will be done in the caller or we have been OOMed.

Fixes: 83651ef5048d (mm: start tracking VMAs with maple tree)
Suggested-by: Hugh Dickins <hughd at google.com>
Signed-off-by: Liam R. Howlett <Liam.Howlett at oracle.com>
---
 mm/mmap.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/mm/mmap.c b/mm/mmap.c
index eed9e9d96e22..87e9e78b03c8 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -970,12 +970,8 @@ int __vma_adjust(struct vm_area_struct *vma, unsigned long start,
 		}
 	}
 	vma_adjust_trans_huge(orig_vma, start, end, adjust_next);
-
-	if (mas_preallocate(&mas, vma, GFP_KERNEL)) {
-		if (exporter && exporter->anon_vma)
-			unlink_anon_vmas(importer);
+	if (mas_preallocate(&mas, vma, GFP_KERNEL))
 		return -ENOMEM;
-	}
 
 	if (file) {
 		mapping = file->f_mapping;
-- 
2.35.1



More information about the maple-tree mailing list