[PATCH] mmap: Remove unroll from vma_expand()

Liam Howlett liam.howlett at oracle.com
Tue Jul 19 11:50:01 PDT 2022


Undoing the anon vma work is no necessary since it will be handled by
the caller in the freeing of the VMA, or in the OOM that is happening.

Fixes: d8bb385648a5 (mm/mmap: use advanced maple tree API for mmap_region())
Suggested-by:Hugh Dickins <hughd at google.com>
Signed-off-by: Liam R. Howlett <Liam.Howlett at oracle.com>
---
 mm/mmap.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/mm/mmap.c b/mm/mmap.c
index 139862557cc1..7440f250581d 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -670,7 +670,6 @@ inline int vma_expand(struct ma_state *mas, struct vm_area_struct *vma,
 	struct anon_vma *anon_vma = vma->anon_vma;
 	struct file *file = vma->vm_file;
 	bool remove_next = false;
-	bool anon_cloned = false;
 
 	if (next && (vma != next) && (end == next->vm_end)) {
 		remove_next = true;
@@ -682,7 +681,6 @@ inline int vma_expand(struct ma_state *mas, struct vm_area_struct *vma,
 			error = anon_vma_clone(vma, next);
 			if (error)
 				return error;
-			anon_cloned = true;
 		}
 	}
 
@@ -765,8 +763,6 @@ inline int vma_expand(struct ma_state *mas, struct vm_area_struct *vma,
 	return 0;
 
 nomem:
-	if (anon_cloned)
-		unlink_anon_vmas(vma);
 	return -ENOMEM;
 }
 
-- 
2.35.1



More information about the maple-tree mailing list