]> git.baikalelectronics.ru Git - kernel.git/commitdiff
mm/swapfile: use vma iterator instead of vma linked list
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Tue, 6 Sep 2022 19:49:04 +0000 (19:49 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Tue, 27 Sep 2022 02:46:25 +0000 (19:46 -0700)
unuse_mm() no longer needs to reference the linked list.

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

index 263b19e693cfa2851fdef56b847a7ec7af48d7b9..469d9af86be2f11b6f3d8cb9bc337f2e491dd097 100644 (file)
@@ -1994,14 +1994,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);