From: Liam R. Howlett Date: Mon, 22 Aug 2022 15:06:28 +0000 (+0000) Subject: mm/gup: use maple tree navigation instead of linked list X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=0f8177140649c385d8658543af8cca15de574cb5;p=users%2Fjedix%2Flinux-maple.git mm/gup: use maple tree navigation instead of linked list 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/20220822150128.1562046-52-Liam.Howlett@oracle.com Signed-off-by: Liam R. Howlett Cc: Catalin Marinas Cc: David Hildenbrand Cc: David Howells Cc: "Matthew Wilcox (Oracle)" Cc: SeongJae Park Cc: Sven Schnelle Cc: Vlastimil Babka Cc: Will Deacon Cc: Yu Zhao Cc: Davidlohr Bueso Signed-off-by: Andrew Morton --- diff --git a/mm/gup.c b/mm/gup.c index ae84989a7d60..3b656b7e8a3c 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -1667,10 +1667,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