Re: [RFC PATCH 6/6] mm: Remove device private pages from the physical address space

Jason Gunthorpe
2025-11-28T17:51:10Z

On Fri, Nov 28, 2025 at 03:41:46PM +1100, Jordan Niethe wrote:
> Introduce helpers:
>
> - device_private_page_to_offset()
> - device_private_folio_to_offset()
>
> to take a given device private page / folio and return its offset within
> the device private address space (this is essentially a PFN within the
> device private address space).

It would be nice if we rarely/never needed to see number space outside
the pte itself or the internal helpers..

Like, I don't think there should be stuff like this:

> entry = make_writable_migration_device_private_entry(
> - page_to_pfn(page));
> + device_private_page_to_offset(page));

make_writable_migration_device_private_entry() should accept the
struct page as the handle?

If it really is needed I think it should have its own dedicated type
and not be intermixed with normal pfns..

Jason