lkml.org 
[lkml]   [2022]   [Jun]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v10 13/69] mm/mmap: use maple tree for unmapped_area{_topdown}
On 21.06.22 22:46, Liam Howlett wrote:
> From: "Liam R. Howlett" <Liam.Howlett@Oracle.com>
>
> The maple tree code was added to find the unmapped area in a previous
> commit and was checked against what the rbtree returned, but the actual
> result was never used. Start using the maple tree implementation and
> remove the rbtree code.
>
> Add kernel documentation comment for these functions.
>
> Link: https://lkml.kernel.org/r/20220504010716.661115-15-Liam.Howlett@oracle.com
> Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: David Howells <dhowells@redhat.com>
> Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>
> Cc: SeongJae Park <sj@kernel.org>
> Cc: Vlastimil Babka <vbabka@suse.cz>
> Cc: Will Deacon <will@kernel.org>
> Cc: Davidlohr Bueso <dave@stgolabs.net>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
> mm/mmap.c | 253 +++++++-----------------------------------------------
> 1 file changed, 32 insertions(+), 221 deletions(-)
>
> diff --git a/mm/mmap.c b/mm/mmap.c
> index 08845a0317bf..b91d22329418 100644
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -2053,250 +2053,61 @@ unsigned long mmap_region(struct file *file, unsigned long addr,
> return error;
> }
>
> +/* unmapped_area() Find an area between the low_limit and the high_limit with

/**
* unmapped_area() - ...

> + * the correct alignment and offset, all from @info. Note: current->mm is used
> + * for the search.
> + *
> + * @info: The unmapped area information including the range (low_limit -
> + * hight_limit), the alignment offset and mask.
> + *
> + * Return: A memory address or -ENOMEM.
> + */
> static unsigned long unmapped_area(struct vm_unmapped_area_info *info)
> {

...

>
> +/* unmapped_area_topdown() Find an area between the low_limit and the

\Dito

> + * high_limit with * the correct alignment and offset at the highest available
> + * address, all from * @info. Note: current->mm is used for the search.

I'm confused about the "*" in the text, but maybe I'm just tired :)

> + *
> + * @info: The unmapped area information including the range (low_limit -
> + * hight_limit), the alignment offset and mask.
> + *
> + * Return: A memory address or -ENOMEM.
> + */
> static unsigned long unmapped_area_topdown(struct vm_unmapped_area_info *info)
> {

[...]

> -found:
> - /* We found a suitable gap. Clip it with the original high_limit. */
> - if (gap_end > info->high_limit)
> - gap_end = info->high_limit;
> -
> -found_highest:
> - /* Compute highest gap address at the desired alignment */
> - gap_end -= info->length;
> - gap_end -= (gap_end - info->align_offset) & info->align_mask;
> -
> - VM_BUG_ON(gap_end < info->low_limit);
> - VM_BUG_ON(gap_end < gap_start);

Can we leave some of these in, please? (same applies to other function)

I keep getting confused by align_offset. vs align_mask. I *think* this
is correct, but some checks that we stay in limits and actually have
proper alignment would be reasonable.


--
Thanks,

David / dhildenb

\
 
 \ /
  Last update: 2022-06-23 20:26    [W:0.434 / U:0.240 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site