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: <YRnO5gudWRvGjxW4@casper.infradead.org>
Date:   Mon, 16 Aug 2021 03:35:18 +0100
From:   Matthew Wilcox <willy@...radead.org>
To:     David Howells <dhowells@...hat.com>
Cc:     linux-kernel@...r.kernel.org, linux-mm@...ck.org,
        linux-fsdevel@...r.kernel.org, Christoph Hellwig <hch@....de>
Subject: Re: [PATCH v14 084/138] mm/page_alloc: Add folio allocation functions

On Tue, Aug 10, 2021 at 10:51:23PM +0100, David Howells wrote:
> Matthew Wilcox (Oracle) <willy@...radead.org> wrote:
> 
> > +struct folio *folio_alloc(gfp_t gfp, unsigned order)
> > +{
> > +	struct page *page = alloc_pages(gfp | __GFP_COMP, order);
> > +
> > +	if (page && order > 1)
> > +		prep_transhuge_page(page);
> 
> Ummm...  Shouldn't order==1 pages (two page folios) be prep'd also?

No.  The deferred list is stored in the second tail page, so there's
nowhere to store one if there are only two pages.

The free_transhuge_page() dtor only handles the deferred list, so
it's fine to skip setting the DTOR in the page too.

> Would it be better to just jump to alloc_pages() if order <= 1?  E.g.:
> 
> struct folio *folio_alloc(gfp_t gfp, unsigned order)
> {
> 	struct page *page;
> 
> 	if (order <= 1)
> 		return (struct folio *)alloc_pages(gfp | __GFP_COMP, order);
> 
> 	page = alloc_pages(gfp | __GFP_COMP, order);
> 	if (page)
> 		prep_transhuge_page(page);
> 	return (struct folio *)page;
> }

That doesn't look simpler to me?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ