Commit 208c09db authored by Liam R. Howlett's avatar Liam R. Howlett Committed by Andrew Morton

mm/swapfile: use vma iterator instead of vma linked list

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

Link: https://lkml.kernel.org/r/20220906194824.2110408-64-Liam.Howlett@oracle.comSigned-off-by: default avatarLiam R. Howlett <Liam.Howlett@Oracle.com>
Acked-by: default avatarVlastimil Babka <vbabka@suse.cz>
Reviewed-by: default avatarDavidlohr Bueso <dave@stgolabs.net>
Tested-by: default avatarYu 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: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 9ec08f30
...@@ -1994,14 +1994,16 @@ static int unuse_mm(struct mm_struct *mm, unsigned int type) ...@@ -1994,14 +1994,16 @@ static int unuse_mm(struct mm_struct *mm, unsigned int type)
{ {
struct vm_area_struct *vma; struct vm_area_struct *vma;
int ret = 0; int ret = 0;
VMA_ITERATOR(vmi, mm, 0);
mmap_read_lock(mm); mmap_read_lock(mm);
for (vma = mm->mmap; vma; vma = vma->vm_next) { for_each_vma(vmi, vma) {
if (vma->anon_vma) { if (vma->anon_vma) {
ret = unuse_vma(vma, type); ret = unuse_vma(vma, type);
if (ret) if (ret)
break; break;
} }
cond_resched(); cond_resched();
} }
mmap_read_unlock(mm); mmap_read_unlock(mm);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment