Skip to content

Commit

Permalink
mm/swapfile: use vma iterator instead of vma linked list
Browse files Browse the repository at this point in the history
unuse_mm() no longer needs to reference the linked list.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Reviewed-by: Davidlohr Bueso <dave@stgolabs.net>
Signed-off-by: Alexandre Frade <kernel@xanmod.org>
  • Loading branch information
howlett authored and xanmod committed Oct 3, 2022
1 parent 3f2dc51 commit 07fa267
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mm/swapfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -1990,14 +1990,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);
Expand Down

0 comments on commit 07fa267

Please sign in to comment.