]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm/khugepaged: optimize collapse_pte_mapped_thp() by using vma_lookup()
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Mon, 22 Aug 2022 15:04:35 +0000 (15:04 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 22 Aug 2022 22:58:22 +0000 (15:58 -0700)
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.

Link: https://lkml.kernel.org/r/20220822150128.1562046-22-Liam.Howlett@oracle.com
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
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>
Cc: Yu Zhao <yuzhao@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/khugepaged.c

index 3e64105398c3d12f9afec7921806d384b974a283..d3313b7a8fe5cb643e05530e2f6b902e3bd847ae 100644 (file)
@@ -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;