Matthew Wilcox <willy@xxxxxxxxxxxxx> writes: > On Thu, Apr 11, 2024 at 10:57:28AM +1000, Alistair Popple wrote: >> Supporting compound zone device pages requires compound_head() to >> distinguish between head and tail pages whilst still preserving the >> special struct page fields that are specific to zone device pages. >> >> A tail page is distinguished by having bit zero being set in >> page->compound_head, with the remaining bits pointing to the head >> page. For zone device pages page->compound_head is shared with >> page->pgmap. >> >> The page->pgmap field is common to all pages within a memory section. >> Therefore pgmap is the same for both head and tail pages and we can >> use the same scheme to distinguish tail pages. To obtain the pgmap for >> a tail page a new accessor is introduced to fetch it from >> compound_head. > > Would it make sense at this point to move pgmap and zone_device_data > from struct page to struct folio? That will make any forgotten > places fail to compile instead of getting a bogus value. Thanks for the suggestion, I think that makes a lot of sense. Will try it for the next version to see what it looks like.