From: Liam R. Howlett Date: Wed, 20 Jul 2022 02:17:50 +0000 (+0000) Subject: mm/khugepaged: optimize collapse_pte_mapped_thp() by using vma_lookup() X-Git-Tag: howlett/maple/20220906~49 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=40f4be06119abe10d29fbb06c20fa2c3ac14c1fc;p=users%2Fjedix%2Flinux-maple.git mm/khugepaged: optimize collapse_pte_mapped_thp() by using vma_lookup() vma_lookup() will walk the vma tree once and not continue to look for the next vma. Since the exact vma is checked below, this is a more optimal way of searching. Signed-off-by: Liam R. Howlett Reviewed-by: Vlastimil Babka --- diff --git a/mm/khugepaged.c b/mm/khugepaged.c index 3e64105398c3..d3313b7a8fe5 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -1392,7 +1392,7 @@ static void collapse_and_free_pmd(struct mm_struct *mm, struct vm_area_struct *v void collapse_pte_mapped_thp(struct mm_struct *mm, unsigned long addr) { unsigned long haddr = addr & HPAGE_PMD_MASK; - struct vm_area_struct *vma = find_vma(mm, haddr); + struct vm_area_struct *vma = vma_lookup(mm, haddr); struct page *hpage; pte_t *start_pte, *pte; pmd_t *pmd;