Re: [PATCHv6 08/17] mm: Make page_zonenum() use head page

Matthew Wilcox
2026-02-15T23:14:13Z

On Mon, Feb 02, 2026 at 03:56:24PM +0000, Kiryl Shutsemau wrote:
> With the upcoming changes to HVO, a single page of tail struct pages
> will be shared across all huge pages of the same order on a node. Since
> huge pages on the same node may belong to different zones, the zone
> information stored in shared tail page flags would be incorrect.
>
> Always fetch zone information from the head page, which has unique and
> correct zone flags for each compound page.

You're right that different pages in the same folio can have different
zone number. But does it matter ... or to put it another way, why is
returning the zone number of the head page the correct way to resolve
this?

Arguably, the caller is asking for the zone number of _this page_, and
does not care about the zone number of the head page. It would be good
to have a short discussion of this in the commit message (but probably
not worth putting this in a comment).