]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm/memory: Optimize free_pgtables() ma_state use
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Tue, 12 Jan 2021 16:40:17 +0000 (11:40 -0500)
committerLiam R. Howlett <Liam.Howlett@Oracle.com>
Tue, 12 Jan 2021 16:40:17 +0000 (11:40 -0500)
increment a single maple tree iterator and copy the result instead of
incrementing two iterators

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
mm/memory.c

index f0e0adf8f491a77e3161de4ba917d79b60fefa28..e16041d872836da598512f2cecf558778568be66 100644 (file)
@@ -415,8 +415,9 @@ void free_pgtables(struct mmu_gather *tlb, struct ma_state *mas,
                         */
                        while (next && next->vm_start <= vma->vm_end + PMD_SIZE
                               && !is_vm_hugetlb_page(next)) {
+                               *mas = ma_next;
+                               vma = next;
                                next = mas_find(&ma_next, ceiling - 1);
-                               vma = mas_find(mas, ceiling - 1);
                                BUG_ON(vma->vm_start < floor);
                                BUG_ON(vma->vm_end -1 > ceiling - 1);
                                unlink_anon_vmas(vma);
@@ -425,7 +426,9 @@ void free_pgtables(struct mmu_gather *tlb, struct ma_state *mas,
                        free_pgd_range(tlb, addr, vma->vm_end,
                                floor, next ? next->vm_start : ceiling);
                }
-       } while ((vma = mas_find(mas, (ceiling - 1))) != NULL);
+               *mas = ma_next;
+               vma = next;
+       } while (vma);
 }
 
 int __pte_alloc(struct mm_struct *mm, pmd_t *pmd)