Re: [PATCH v4 15/66] mm: Convert vma_lookup() to use the Maple Tree

From: Vlastimil Babka
Date: Fri Dec 17 2021 - 06:59:11 EST


Re: subject. It already uses the Maple Tree via find_vma(). So more accurate
would be e.g. "to use mtree_load()"?

Note there's also the side-effect of not using vmacache anymore (which is
still used in find_vma()), thus again potentially biasing results of later
vmacache removal. But seems like vma_lookup() is not used from hotpaths, so
it should be fine.

On 12/1/21 15:29, Liam Howlett wrote:
> From: "Matthew Wilcox (Oracle)" <willy@xxxxxxxxxxxxx>
>
> Unlike the rbtree, the Maple Tree will return a NULL if there's
> nothing at a particular address.
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx>
> Signed-off-by: Liam R. Howlett <Liam.Howlett@xxxxxxxxxx>

Acked-by: Vlastimil Babka <vbabka@xxxxxxx>

> ---
> include/linux/mm.h | 7 +------
> 1 file changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index 4d5ab70b1f6d..c28bd97a4ecd 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -2845,12 +2845,7 @@ struct vm_area_struct *find_vma_intersection(struct mm_struct *mm,
> static inline
> struct vm_area_struct *vma_lookup(struct mm_struct *mm, unsigned long addr)
> {
> - struct vm_area_struct *vma = find_vma(mm, addr);
> -
> - if (vma && addr < vma->vm_start)
> - vma = NULL;
> -
> - return vma;
> + return mtree_load(&mm->mm_mt, addr);
> }
>
> static inline unsigned long vm_start_gap(struct vm_area_struct *vma)