Thread (24 messages) 24 messages, 5 authors, 2026-01-14

Re: [PATCH v6 3/4] iommu: debug-pagealloc: Track IOMMU pages

From: Jason Gunthorpe <jgg@ziepe.ca>
Date: 2026-01-12 19:17:43
Also in: linux-iommu, linux-mm, lkml

On Mon, Jan 12, 2026 at 08:11:50PM +0100, David Hildenbrand (Red Hat) wrote:
On 1/12/26 15:58, Mostafa Saleh wrote:
quoted
On Mon, Jan 12, 2026 at 1:52 PM Jason Gunthorpe [off-list ref] wrote:
quoted
On Mon, Jan 12, 2026 at 01:43:41PM +0000, Mostafa Saleh wrote:
quoted
But I don’t see why not. from the documentation:
/**
  * pfn_valid - check if there is a valid memory map entry for a PFN
  * @pfn: the page frame number to check
  *
  * Check if there is a valid memory map entry aka struct page for the @pfn.
  * Note, that availability of the memory map entry does not imply that
  * there is actual usable memory at that @pfn. The struct page may
  * represent a hole or an unusable page frame.
…

That means that struct page exists, which is all what we need here.
A struct page that has never been initialize shouldn't ever be read. I
don't know how that relates to page_ext, but are you really sure that
is all you need?
AFAIU, if pfn_valid() returns true, it means the struct page is valid,
and lookup_page_ext() will check that a valid page_ext exists for this
entry.
Not always. Offline memory blocks have a memory map but no page ext. We
allocate the page ext at memory onlining time.

Also, I'm not sure about ZONE_DEVICE memory, very likely we never allocate a
page_ext for them?

I'd assume both cases are not relevant for your use case, though.
They are in the sense that those PFNs can get into these routines and
still need to be handled in some appropriate way..

Jason
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help