]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm/swapfile: Use maple tree iterator instead of vma linked list
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Mon, 4 Jan 2021 20:07:11 +0000 (15:07 -0500)
committerMatthew Wilcox (Oracle) <willy@infradead.org>
Mon, 1 Nov 2021 14:43:50 +0000 (10:43 -0400)
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
mm/swapfile.c

index 22d10f7138487434a56bb37216b1fc868882212e..ea7e29ca82ef558546d25bbcef299b3dfca18d07 100644 (file)
@@ -2103,15 +2103,18 @@ static int unuse_mm(struct mm_struct *mm, unsigned int type,
 {
        struct vm_area_struct *vma;
        int ret = 0;
+       MA_STATE(mas, &mm->mm_mt, 0, 0);
 
        mmap_read_lock(mm);
-       for (vma = mm->mmap; vma; vma = vma->vm_next) {
+       mas_for_each(&mas, vma, ULONG_MAX) {
                if (vma->anon_vma) {
                        ret = unuse_vma(vma, type, frontswap,
                                        fs_pages_to_unuse);
                        if (ret)
                                break;
                }
+
+               mas_pause(&mas);
                cond_resched();
        }
        mmap_read_unlock(mm);