Re: [PATCH v13 33/70] powerpc: remove mmap linked list walks

Davidlohr Bueso
2022-08-23T19:59:11Z

On Mon, 22 Aug 2022, Liam Howlett wrote:

>From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
>
>Use the VMA iterator instead.
>
>Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
>Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
>Reviewed-by: Vlastimil Babka <vbabka@suse.cz>

Reviewed-by: Davidlohr Bueso <dave@stgolabs.net>

>---
> arch/powerpc/kernel/vdso.c | 6 +++---
> arch/powerpc/mm/book3s32/tlb.c | 11 ++++++-----
> arch/powerpc/mm/book3s64/subpage_prot.c | 13 ++-----------
> 3 files changed, 11 insertions(+), 19 deletions(-)
>
>diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c
>index 0da287544054..94a8fa5017c3 100644
>--- a/arch/powerpc/kernel/vdso.c
>+++ b/arch/powerpc/kernel/vdso.c
>@@ -113,18 +113,18 @@ struct vdso_data *arch_get_vdso_data(void *vvar_page)
> int vdso_join_timens(struct task_struct *task, struct time_namespace *ns)
> {
> struct mm_struct *mm = task->mm;
>+ VMA_ITERATOR(vmi, mm, 0);
> struct vm_area_struct *vma;
>
> mmap_read_lock(mm);
>-
>- for (vma = mm->mmap; vma; vma = vma->vm_next) {
>+ for_each_vma(vmi, vma) {
> unsigned long size = vma->vm_end - vma->vm_start;

Unrelated, but maybe worth abstracting?

$> grep "vma->vm_end - vma->vm_start" |wc -l
216

Thanks,
Davidlohr