[PATCH v9 02/14] mm: move page zone helpers from mm.h to mmzone.h
Peter Xu
peterx at redhat.com
Thu Jun 15 19:33:12 UTC 2023
Hello, all,
On Fri, Jul 15, 2022 at 10:05:09AM -0500, Alex Sierra wrote:
> +static inline enum zone_type page_zonenum(const struct page *page)
> +{
> + ASSERT_EXCLUSIVE_BITS(page->flags, ZONES_MASK << ZONES_PGSHIFT);
> + return (page->flags >> ZONES_PGSHIFT) & ZONES_MASK;
> +}
Sorry to hijack this patch - not directly relevant to the movement, but
relevant to this helper, so maybe I can leverage the cc list..
My question is whether page_zonenum() is ready for taking all kinds of tail
pages?
Zone device tail pages all look fine, per memmap_init_zone_device(). The
question was other kinds of usual compound pages, like either thp or
hugetlb. IIUC page->flags can be uninitialized for those tail pages.
Asking because I noticed it seems possible that page_zonenum() can just
take any random tail page as input, e.g.:
try_grab_folio -> is_pci_p2pdma_page -> is_zone_device_page -> page_zonenum
I'm worried it'll just read fake things, but maybe I just missed something?
Thanks,
--
Peter Xu
More information about the dri-devel
mailing list