[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1814546.1628632283@warthog.procyon.org.uk>
Date: Tue, 10 Aug 2021 22:51:23 +0100
From: David Howells <dhowells@...hat.com>
To: "Matthew Wilcox (Oracle)" <willy@...radead.org>
Cc: dhowells@...hat.com, 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
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?
> + return (struct folio *)page;
> +}
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;
}
David
Powered by blists - more mailing lists