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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx> 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




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux