mm/gup: use maple tree navigation instead of linked list
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Thu, 14 Apr 2022 06:07:21 +0000 (23:07 -0700)
committerLiam R. Howlett <Liam.Howlett@oracle.com>
Thu, 14 Apr 2022 21:49:48 +0000 (17:49 -0400)
Use find_vma_intersection() to locate the VMAs in __mm_populate() instead
of using find_vma() and the linked list.

Link: https://lkml.kernel.org/r/20220404143501.2016403-53-Liam.Howlett@oracle.com
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/gup.c

index 5c17d48164418024a4c04b238f5ba26209226dec..d6dd04b8d803675c981cb05617565433189f5825 100644 (file)
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -1609,10 +1609,11 @@ int __mm_populate(unsigned long start, unsigned long len, int ignore_errors)
                if (!locked) {
                        locked = 1;
                        mmap_read_lock(mm);
-                       vma = find_vma(mm, nstart);
+                       vma = find_vma_intersection(mm, nstart, end);
                } else if (nstart >= vma->vm_end)
-                       vma = vma->vm_next;
-               if (!vma || vma->vm_start >= end)
+                       vma = find_vma_intersection(mm, vma->vm_end, end);
+
+               if (!vma)
                        break;
                /*
                 * Set [nstart; nend) to intersection of desired address