]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
powerpc: Remove mmap linked list walks
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Mon, 4 Jan 2021 19:25:54 +0000 (14:25 -0500)
committerLiam R. Howlett <Liam.Howlett@oracle.com>
Mon, 14 Mar 2022 18:49:45 +0000 (14:49 -0400)
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>
arch/powerpc/kernel/vdso.c
arch/powerpc/mm/book3s32/tlb.c
arch/powerpc/mm/book3s64/subpage_prot.c

index 717f2c9a7573cf395d41c338de1a99fb8d65fbf8..f70db911e061c95bae3476aa46be2bc0f9e3c5c4 100644 (file)
@@ -114,18 +114,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;
 
                if (vma_is_special_mapping(vma, &vvar_spec))
                        zap_page_range(vma, vma->vm_start, size);
        }
-
        mmap_read_unlock(mm);
+
        return 0;
 }
 
index 19f0ef950d77322d5d0be1ccf18c3820e6b4bcb1..9ad6b56bfec96e989b96f027d075ad5812500854 100644 (file)
@@ -81,14 +81,15 @@ EXPORT_SYMBOL(hash__flush_range);
 void hash__flush_tlb_mm(struct mm_struct *mm)
 {
        struct vm_area_struct *mp;
+       VMA_ITERATOR(vmi, mm, 0);
 
        /*
-        * It is safe to go down the mm's list of vmas when called
-        * from dup_mmap, holding mmap_lock.  It would also be safe from
-        * unmap_region or exit_mmap, but not from vmtruncate on SMP -
-        * but it seems dup_mmap is the only SMP case which gets here.
+        * It is safe to iterate the vmas when called from dup_mmap,
+        * holding mmap_lock.  It would also be safe from unmap_region
+        * or exit_mmap, but not from vmtruncate on SMP - but it seems
+        * dup_mmap is the only SMP case which gets here.
         */
-       for (mp = mm->mmap; mp != NULL; mp = mp->vm_next)
+       for_each_vma(vmi, mp)
                hash__flush_range(mp->vm_mm, mp->vm_start, mp->vm_end);
 }
 EXPORT_SYMBOL(hash__flush_tlb_mm);
index 60c6ea16a972afc6e26bd615bd3eba2968c1a8a8..d73b3b4176e81d2112a4e5e1cbd6bdff8d678aa4 100644 (file)
@@ -149,24 +149,15 @@ static void subpage_mark_vma_nohuge(struct mm_struct *mm, unsigned long addr,
                                    unsigned long len)
 {
        struct vm_area_struct *vma;
+       VMA_ITERATOR(vmi, mm, addr);
 
        /*
         * We don't try too hard, we just mark all the vma in that range
         * VM_NOHUGEPAGE and split them.
         */
-       vma = find_vma(mm, addr);
-       /*
-        * If the range is in unmapped range, just return
-        */
-       if (vma && ((addr + len) <= vma->vm_start))
-               return;
-
-       while (vma) {
-               if (vma->vm_start >= (addr + len))
-                       break;
+       for_each_vma_range(vmi, vma, addr + len) {
                vma->vm_flags |= VM_NOHUGEPAGE;
                walk_page_vma(vma, &subpage_walk_ops, NULL);
-               vma = vma->vm_next;
        }
 }
 #else