2022-08-22 15:37:43

by Liam R. Howlett

[permalink] [raw]
Subject: [PATCH v13 63/70] mm/swapfile: use vma iterator instead of vma linked list

From: "Liam R. Howlett" <[email protected]>

unuse_mm() no longer needs to reference the linked list.

Signed-off-by: Liam R. Howlett <[email protected]>
Acked-by: Vlastimil Babka <[email protected]>
---
mm/swapfile.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/mm/swapfile.c b/mm/swapfile.c
index 263b19e693cf..469d9af86be2 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -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);
--
2.35.1


2022-08-31 02:31:19

by Davidlohr Bueso

[permalink] [raw]
Subject: Re: [PATCH v13 63/70] mm/swapfile: use vma iterator instead of vma linked list

On Mon, 22 Aug 2022, Liam Howlett wrote:

>From: "Liam R. Howlett" <[email protected]>
>
>unuse_mm() no longer needs to reference the linked list.
>
>Signed-off-by: Liam R. Howlett <[email protected]>
>Acked-by: Vlastimil Babka <[email protected]>

Reviewed-by: Davidlohr Bueso <[email protected]>