Re: [PATCH 02/12] mm: Convert pXd_devmap checks to vma_is_dax

Dan Williams
2025-06-05T01:38:11Z

Alistair Popple wrote:
> Currently dax is the only user of pmd and pud mapped ZONE_DEVICE
> pages. Therefore page walkers that want to exclude DAX pages can check
> pmd_devmap or pud_devmap. However soon dax will no longer set PFN_DEV,
> meaning dax pages are mapped as normal pages.
>
> Ensure page walkers that currently use pXd_devmap to skip DAX pages
> continue to do so by adding explicit checks of the VMA instead.

tl;dr:

Reviewed-by: Dan Williams <dan.j.williams@intel.com>

So I went through all the p[mu]d_devmap() checks and indeed this is the
set I also come up with that are implicitly checking for "dax" instead
of checking for "is this a larger than base pte size mapping".

While I am a little uncomfortable with the generality of calling the
policy "dax" in these locations I think it is ok for now. I.e. the
fundamental detail in these paths is "huge pte, but not typical
page-allocator THP page"

Also I would have felt better if some of the leftover places that are
doing "dax" checks but not updated were noted in the changelog just for
review purposes. Like:

"Note paths like follow_huge_pud and follow_pmd_mask also have 'dax'
checks, but those paths are for maintaining dev_pagemap refcounts which
no longer (since v6.15) need to be managed for dax pages. A later patch
cleans those up."