[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5972b785-a98a-ca3d-8c21-8156dd981749@redhat.com>
Date: Thu, 23 Jun 2022 19:25:53 +0200
From: David Hildenbrand <david@...hat.com>
To: Liam Howlett <liam.howlett@...cle.com>,
"maple-tree@...ts.infradead.org" <maple-tree@...ts.infradead.org>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
"damon @ lists . linux . dev" <damon@...ts.linux.dev>,
SeongJae Park <sj@...nel.org>
Subject: Re: [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@...cle.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@...cle.com>
> Cc: Catalin Marinas <catalin.marinas@....com>
> Cc: David Howells <dhowells@...hat.com>
> Cc: "Matthew Wilcox (Oracle)" <willy@...radead.org>
> Cc: SeongJae Park <sj@...nel.org>
> Cc: Vlastimil Babka <vbabka@...e.cz>
> Cc: Will Deacon <will@...nel.org>
> Cc: Davidlohr Bueso <dave@...olabs.net>
> Signed-off-by: Andrew Morton <akpm@...ux-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
Powered by blists - more mailing lists