Thread (389 messages) 389 messages, 13 authors, 2021-08-21

Re: [PATCH v14 084/138] mm/page_alloc: Add folio allocation functions

From: David Howells <dhowells@redhat.com>
Date: 2021-08-10 21:51:35
Also in: linux-fsdevel, linux-mm

Matthew Wilcox (Oracle) [off-list ref] 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help