Re: [RFC PATCH v2] page_alloc: allow migration of smaller hugepages during contig_alloc
From: Gregory Price
Date: Tue Oct 21 2025 - 12:03:42 EST
On Tue, Oct 21, 2025 at 09:14:43AM +0000, Wei Yang wrote:
>
> The above code is expanded to:
>
> page = _compound_head(page);
> order = compound_order(page);
> folio = page;
> test_bit(PG_head, &folio->flags.f);
> return folio_large_order(folio);
>
> If we use
>
> order = folio_order(page_folio(page))
>
> It is expanded to:
>
> folio = _compound_head(page);
> folio_test_large(folio)
> folio_test_head(folio)
> test_bit(PG_head, &folio->flags.f)
> return folio_large_order(folio);
>
> These two seems expanded to the same code.
>
folio_test_large drops into const_folio_flags which does
a VM_BUG_ON_PGFLAGS, so not the same logic here.
> Maybe we can use folio_order() here?
>