Re: [PATCH 00/12] mm: Remove pXX_devmap page table bit and pfn_t type

David Hildenbrand
2025-06-02T10:31:49Z

On 29.05.25 08:32, Alistair Popple wrote:
> Changes from v2 of the RFC[1]:
>
> - My ZONE_DEVICE refcount series has been merged as commit 7851bf649d42 (Patch series
> "fs/dax: Fix ZONE_DEVICE page reference counts", v9.) which is included in
> v6.15 so have rebased on top of that.
>
> - No major changes required for the rebase other than fixing up a new user of
> the pfn_t type (intel_th).
>
> - As a reminder the main benefit of this series is it frees up a PTE bit
> (pte_devmap).
>
> - This may be a bit late to consider for inclusion in v6.16 unless it can get
> some more reviews before the merge window closes. I don't think missing v6.16
> is a huge issue though.
>
> - This passed xfstests for a XFS filesystem with DAX enabled on my system and
> as many of the ndctl tests that pass on my system without it.
>
> Changes for v2:
>
> - This is an update to my previous RFC[2] removing just pfn_t rebased
> on today's mm-unstable which includes my ZONE_DEVICE refcounting
> clean-up.
>
> - The removal of the devmap PTE bit and associated infrastructure was
> dropped from that series so I have rolled it into this series.
>
> - Logically this series makes sense to me, but the dropping of devmap
> is wide ranging and touches some areas I'm less familiar with so
> would definitely appreciate any review comments there.
>
> [1] - https://lore.kernel.org/linux-mm/cover.95ff0627bc727f2bae44bea4c00ad7a83fbbcfac.1739941374.git-series.apopple@nvidia.com/
> [2] - https://lore.kernel.org/linux-mm/cover.a7cdeffaaa366a10c65e2e7544285059cc5d55a4.1736299058.git-series.apopple@nvidia.com/
>
> All users of dax now require a ZONE_DEVICE page which is properly
> refcounted. This means there is no longer any need for the PFN_DEV, PFN_MAP
> and PFN_SPECIAL flags. Furthermore the PFN_SG_CHAIN and PFN_SG_LAST flags
> never appear to have been used. It is therefore possible to remove the
> pfn_t type and replace any usage with raw pfns.
>
> The remaining users of PFN_DEV have simply passed this to
> vmf_insert_mixed() to create pte_devmap() mappings. It is unclear why this
> was the case but presumably to ensure vm_normal_page() does not return
> these pages. These users can be trivially converted to raw pfns and
> creating a pXX_special() mapping to ensure vm_normal_page() still doesn't
> return these pages.
>
> Now that there are no users of PFN_DEV we can remove the devmap page table
> bit and all associated functions and macros, freeing up a software page
> table bit.
>

$ git grep FS_DAX_LIMITED
fs/Kconfig: depends on ZONE_DEVICE || FS_DAX_LIMITED
fs/Kconfig:config FS_DAX_LIMITED
fs/dax.c: if (IS_ENABLED(CONFIG_FS_DAX_LIMITED))
fs/dax.c: if (IS_ENABLED(CONFIG_FS_DAX_LIMITED))
fs/dax.c: if (IS_ENABLED(CONFIG_FS_DAX_LIMITED))
include/linux/pfn_t.h: * PFN_SPECIAL - for CONFIG_FS_DAX_LIMITED builds
to allow XIP, but not
mm/memremap.c: if (IS_ENABLED(CONFIG_FS_DAX_LIMITED)) {

Can we remove that? Especially the interaction with PFN_SPECIAL looks
concerning.

--
Cheers,

David / dhildenb