lkml.org 
[lkml]   [2021]   [Aug]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH v14 084/138] mm/page_alloc: Add folio allocation functions
Date
Matthew Wilcox (Oracle) <willy@infradead.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

\
 
 \ /
  Last update: 2021-08-10 23:52    [W:1.195 / U:1.192 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site