From: Liam R. Howlett Date: Thu, 18 May 2023 14:55:44 +0000 (-0400) Subject: mm: avoid rewalk in mmap_region X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=5c1c03de1b1636f041a275e777171307cac8d958;p=linux.git mm: avoid rewalk in mmap_region If the iterator has moved to the previous entry, then step forward one range, back to the gap. Link: https://lkml.kernel.org/r/20230518145544.1722059-36-Liam.Howlett@oracle.com Signed-off-by: Liam R. Howlett Cc: David Binderman Cc: Peng Zhang Cc: Sergey Senozhatsky Cc: Vernon Yang Cc: Wei Yang Signed-off-by: Andrew Morton --- diff --git a/mm/mmap.c b/mm/mmap.c index 19d3c843be0c4..44be7fdfaac91 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -2606,6 +2606,9 @@ unsigned long mmap_region(struct file *file, unsigned long addr, } cannot_expand: + if (prev) + vma_iter_next_range(&vmi); + /* * Determine the object being mapped and call the appropriate * specific mapper. the address has already been validated, but