On Tue, 13 Jun 2023 19:13:09 -0700 "Vishal Moola (Oracle)" <vishal.moola@xxxxxxxxx> wrote: > Introduce folio_migratetype() as a folio equivalent for > get_pageblock_migratetype(). This function intends to return the > migratetype the folio is located in, hence the name choice. > > ... > > --- a/include/linux/mmzone.h > +++ b/include/linux/mmzone.h > @@ -105,6 +105,9 @@ extern int page_group_by_mobility_disabled; > #define get_pageblock_migratetype(page) \ > get_pfnblock_flags_mask(page, page_to_pfn(page), MIGRATETYPE_MASK) > > +#define folio_migratetype(folio) \ > + get_pfnblock_flags_mask(&folio->page, folio_pfn(folio), \ > + MIGRATETYPE_MASK) Theoretically this is risky because it evaluates its argument more than once. Although folio_migratetype(folio++) seems an unlikely thing to do. An inlined C function is always preferable. My quick attempt at that reveals that the header files are All Messed Up As Usual.