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>
  • Loading branch information
Liam R. Howlett authored and Liam R. Howlett committed Feb 20, 2022
1 parent e9036a3 commit 88186c9
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 @@ -2071,14 +2071,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 88186c9

Please sign in to comment.