[PATCH v4 16/66] mm: Remove rb tree.

Vlastimil Babka vbabka at suse.cz
Wed Jan 12 04:02:50 PST 2022


On 12/1/21 15:29, Liam Howlett wrote:
> From: "Liam R. Howlett" <Liam.Howlett at Oracle.com>
> 
> Remove the RB tree and start using the maple tree for vm_area_struct
> tracking.
> 
> Drop validate_mm() calls in expand_upwards() and expand_downwards() as
> the lock is not held.
> 
> Signed-off-by: Liam R. Howlett <Liam.Howlett at Oracle.com>

Acked-by: Vlastimil Babka <vbabka at suse.cz>

> ---
>  arch/x86/kernel/tboot.c    |   1 -
>  drivers/firmware/efi/efi.c |   1 -
>  include/linux/mm.h         |   2 -
>  include/linux/mm_types.h   |  14 --
>  kernel/fork.c              |   8 -
>  mm/init-mm.c               |   2 -
>  mm/mmap.c                  | 496 ++++++++-----------------------------
>  mm/nommu.c                 |  88 ++-----
>  mm/util.c                  |   8 +
>  9 files changed, 136 insertions(+), 484 deletions(-)

Nice stats.

Wanted to suggest splitting out the swith to range_has_overlap() but I think
I see how it's not feasible.

> diff --git a/mm/util.c b/mm/util.c
> index e58151a61255..ab02382c2d57 100644
> --- a/mm/util.c
> +++ b/mm/util.c
> @@ -287,6 +287,8 @@ void __vma_link_list(struct mm_struct *mm, struct vm_area_struct *vma,
>  	vma->vm_next = next;
>  	if (next)
>  		next->vm_prev = vma;
> +	else
> +		mm->highest_vm_end = vm_end_gap(vma);
>  }
>  
>  void __vma_unlink_list(struct mm_struct *mm, struct vm_area_struct *vma)
> @@ -301,6 +303,12 @@ void __vma_unlink_list(struct mm_struct *mm, struct vm_area_struct *vma)
>  		mm->mmap = next;
>  	if (next)
>  		next->vm_prev = prev;
> +	else {

Nit: style suggests that once else is { } block then if block should be too,
even though it remains a single line.

> +		if (prev)
> +			mm->highest_vm_end = vm_end_gap(prev);
> +		else
> +			mm->highest_vm_end = 0;
> +	}
>  }
>  
>  /* Check if the vma is being used as a stack by this task */




More information about the maple-tree mailing list