From: Liam R. Howlett Date: Mon, 4 Jan 2021 19:56:58 +0000 (-0500) Subject: mm/khugepaged: Use maple tree iterators instead of vma linked list X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=cb62af3f8b71c8b23293ff27ec5c83b2b39ee19f;p=users%2Fjedix%2Flinux-maple.git mm/khugepaged: Use maple tree iterators instead of vma linked list Signed-off-by: Liam R. Howlett --- diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 161c741bbbfb..651a2751bf72 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -2284,11 +2284,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 = vma_next(vma->vm_mm, vma); unsigned long nstart = next->vm_start; nstart += adjust_next; split_huge_pmd_if_needed(next, nstart); diff --git a/mm/khugepaged.c b/mm/khugepaged.c index 77e33f3e0a7c..23fb74e6319a 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -2075,6 +2075,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); @@ -2098,11 +2099,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_mmap_lock; + + address = khugepaged_scan.address; + mt_for_each(&mm->mm_mt, vma, address, ULONG_MAX) { unsigned long hstart, hend; cond_resched();