]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm/khugepaged: Use maple tree iterators instead of vma linked list
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Mon, 4 Jan 2021 19:56:58 +0000 (14:56 -0500)
committerLiam R. Howlett <Liam.Howlett@oracle.com>
Fri, 26 Nov 2021 19:50:34 +0000 (14:50 -0500)
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
mm/huge_memory.c
mm/khugepaged.c

index e5483347291c0720697125e3fa3b4056412caf31..f0f4ff5239eff23dd413b16cc1561f8c1cec0604 100644 (file)
@@ -2270,11 +2270,11 @@ void vma_adjust_trans_huge(struct vm_area_struct *vma,
        split_huge_pmd_if_needed(vma, end);
 
        /*
-        * If we're also updating the vma->vm_next->vm_start,
+        * If we're also updating the vma_next(vma)->vm_start,
         * check if we need to split it.
         */
        if (adjust_next > 0) {
-               struct vm_area_struct *next = vma->vm_next;
+               struct vm_area_struct *next = find_vma(vma->vm_mm, vma->vm_end);
                unsigned long nstart = next->vm_start;
                nstart += adjust_next;
                split_huge_pmd_if_needed(next, nstart);
index 0ff7d72cdd1dfc3dacc290515fab67d0cb3816e8..8f06334817914e2e91798eacfa29f04da2d596ab 100644 (file)
@@ -2083,6 +2083,7 @@ static unsigned int khugepaged_scan_mm_slot(unsigned int pages,
        struct mm_struct *mm;
        struct vm_area_struct *vma;
        int progress = 0;
+       unsigned long address;
 
        VM_BUG_ON(!pages);
        lockdep_assert_held(&khugepaged_mm_lock);
@@ -2106,11 +2107,13 @@ static unsigned int khugepaged_scan_mm_slot(unsigned int pages,
        vma = NULL;
        if (unlikely(!mmap_read_trylock(mm)))
                goto breakouterloop_mmap_lock;
-       if (likely(!khugepaged_test_exit(mm)))
-               vma = find_vma(mm, khugepaged_scan.address);
 
        progress++;
-       for (; vma; vma = vma->vm_next) {
+       if (unlikely(khugepaged_test_exit(mm)))
+               goto breakouterloop;
+
+       address = khugepaged_scan.address;
+       mt_for_each(&mm->mm_mt, vma, address, ULONG_MAX) {
                unsigned long hstart, hend;
 
                cond_resched();