diff mbox series

[v4,20/66] mm/khugepaged: Optimize collapse_pte_mapped_thp() by using vma_lookup()

Message ID 20211201142918.921493-21-Liam.Howlett@oracle.com (mailing list archive)
State New
Headers show
Series Introducing the Maple Tree | expand

Commit Message

Liam R. Howlett Dec. 1, 2021, 2:29 p.m. UTC
From: "Liam R. Howlett" <Liam.Howlett@Oracle.com>

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 <Liam.Howlett@Oracle.com>
---
 mm/khugepaged.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Vlastimil Babka Jan. 12, 2022, 4:42 p.m. UTC | #1
On 12/1/21 15:29, Liam Howlett wrote:
> From: "Liam R. Howlett" <Liam.Howlett@Oracle.com>
> 
> 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 <Liam.Howlett@Oracle.com>

Reviewed-by: Vlastimil Babka <vbabka@suse.cz>

> ---
>  mm/khugepaged.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/khugepaged.c b/mm/khugepaged.c
> index e99101162f1a..0ff7d72cdd1d 100644
> --- a/mm/khugepaged.c
> +++ b/mm/khugepaged.c
> @@ -1433,7 +1433,7 @@ static int khugepaged_add_pte_mapped_thp(struct mm_struct *mm,
>  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, _pmd;
diff mbox series

Patch

diff --git a/mm/khugepaged.c b/mm/khugepaged.c
index e99101162f1a..0ff7d72cdd1d 100644
--- a/mm/khugepaged.c
+++ b/mm/khugepaged.c
@@ -1433,7 +1433,7 @@  static int khugepaged_add_pte_mapped_thp(struct mm_struct *mm,
 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, _pmd;