Signed-off-by: Liam R. Howlett <Liam.Howlett@xxxxxxxxxx> --- mm/khugepaged.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mm/khugepaged.c b/mm/khugepaged.c index 4e3dff13eb70c..fbfcee552da6c 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -2049,6 +2049,7 @@ static unsigned int khugepaged_scan_mm_slot(unsigned int pages, struct mm_struct *mm; struct vm_area_struct *vma; int progress = 0; + MA_STATE(mas, NULL, 0, 0); VM_BUG_ON(!pages); lockdep_assert_held(&khugepaged_mm_lock); @@ -2065,18 +2066,20 @@ static unsigned int khugepaged_scan_mm_slot(unsigned int pages, khugepaged_collapse_pte_mapped_thps(mm_slot); mm = mm_slot->mm; + mas.tree = &mm->mm_mt; /* * Don't wait for semaphore (to avoid long wait times). Just move to * the next mm on the list. */ vma = NULL; + mas_set(&mas, khugepaged_scan.address); if (unlikely(!mmap_read_trylock(mm))) goto breakouterloop_mmap_lock; if (likely(!khugepaged_test_exit(mm))) - vma = find_vma(mm, khugepaged_scan.address); + vma = mas_find(&mas, ULONG_MAX); progress++; - for (; vma; vma = vma->vm_next) { + mas_for_each(&mas, vma, ULONG_MAX) { unsigned long hstart, hend; cond_resched(); -- 2.28.0