[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZItneGX+sqg7WApF@x1n>
Date: Thu, 15 Jun 2023 15:33:12 -0400
From: Peter Xu <peterx@...hat.com>
To: Alex Sierra <alex.sierra@....com>
Cc: jgg@...dia.com, david@...hat.com, Felix.Kuehling@....com,
linux-mm@...ck.org, rcampbell@...dia.com,
linux-ext4@...r.kernel.org, linux-xfs@...r.kernel.org,
amd-gfx@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
hch@....de, jglisse@...hat.com, apopple@...dia.com,
willy@...radead.org, akpm@...ux-foundation.org
Subject: Re: [PATCH v9 02/14] mm: move page zone helpers from mm.h to mmzone.h
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
Powered by blists - more mailing lists