[PATCH v9 63/69] mm/swapfile: use vma iterator instead of vma linked list
From: Liam Howlett
Date: Tue May 03 2022 - 21:18:45 EST
From: "Liam R. Howlett" <Liam.Howlett@xxxxxxxxxx>
unuse_mm() no longer needs to reference the linked list.
Signed-off-by: Liam R. Howlett <Liam.Howlett@xxxxxxxxxx>
Acked-by: Vlastimil Babka <vbabka@xxxxxxx>
---
mm/swapfile.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/mm/swapfile.c b/mm/swapfile.c
index 63c61f8b2611..392bfffc30c9 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -1968,14 +1968,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);
--
2.35.1