lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220714004705.wqw3a5wff7c7cmbo@revolver>
Date:   Thu, 14 Jul 2022 00:47:12 +0000
From:   Liam Howlett <liam.howlett@...cle.com>
To:     David Hildenbrand <david@...hat.com>
CC:     "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}

* David Hildenbrand <david@...hat.com> [220623 13:26]:
> 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() - ...

ack.

> 
> > + * 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

ack.

> 
> > + * 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 :)

So was my auto-formatting, I guess.  I'll fix this.

> 
> > + *
> > + * @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.

Right, so in the version that existed with both rbtree and maple tree
had a BUG_ON if my calculation wasn't the same as the rbtree
calculation.  I'll re-add the VM_BUG_ON() statements as you suggest for
good measure.

Thanks,
Liam

> 
> 
> -- 
> Thanks,
> 
> David / dhildenb
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ