]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm/swapfile: use vma iterator instead of vma linked list
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Tue, 21 Jun 2022 20:47:12 +0000 (20:47 +0000)
committerLiam R. Howlett <Liam.Howlett@oracle.com>
Wed, 20 Jul 2022 00:15:00 +0000 (20:15 -0400)
unuse_mm() no longer needs to reference the linked list.

Link: https://lkml.kernel.org/r/20220504011345.662299-48-Liam.Howlett@oracle.com
Link: https://lkml.kernel.org/r/20220621204632.3370049-64-Liam.Howlett@oracle.com
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: David Howells <dhowells@redhat.com>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Cc: SeongJae Park <sj@kernel.org>
Cc: Will Deacon <will@kernel.org>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/swapfile.c

index a2e66d855b1996768ec7db943ad60aa9cb32712f..ec4c1b276691e8ceff0a51e07f892f91bbcbc5de 100644 (file)
@@ -1991,14 +1991,16 @@ static int unuse_mm(struct mm_struct *mm, unsigned int type)
 {
        struct vm_area_struct *vma;
        int ret = 0;
+       VMA_ITERATOR(vmi, mm, 0);
 
        mmap_read_lock(mm);
-       for (vma = mm->mmap; vma; vma = vma->vm_next) {
+       for_each_vma(vmi, vma) {
                if (vma->anon_vma) {
                        ret = unuse_vma(vma, type);
                        if (ret)
                                break;
                }
+
                cond_resched();
        }
        mmap_read_unlock(mm);