Changes for v2: - This is an update to my previous RFC[1] 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.a7cdeffaaa366a10c65e2e7544285059cc5d55a4.1736299058.git-series.apopple@xxxxxxxxxx/ [2] - https://lore.kernel.org/linux-mm/cover.a782e309b1328f961da88abddbbc48e5b4579021.1739850794.git-series.apopple@xxxxxxxxxx/ 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. --- Cc: gerald.schaefer@xxxxxxxxxxxxx Cc: dan.j.williams@xxxxxxxxx Cc: jgg@xxxxxxxx Cc: willy@xxxxxxxxxxxxx Cc: david@xxxxxxxxxx Cc: linux-kernel@xxxxxxxxxxxxxxx Cc: nvdimm@xxxxxxxxxxxxxxx Cc: linux-fsdevel@xxxxxxxxxxxxxxx Cc: linux-mm@xxxxxxxxx Cc: linux-ext4@xxxxxxxxxxxxxxx Cc: linux-xfs@xxxxxxxxxxxxxxx Cc: jhubbard@xxxxxxxxxx Cc: hch@xxxxxx Cc: zhang.lyra@xxxxxxxxx Cc: debug@xxxxxxxxxxxx Cc: bjorn@xxxxxxxxxx Cc: balbirs@xxxxxxxxxx Alistair Popple (12): mm: Remove PFN_MAP, PFN_SG_CHAIN and PFN_SG_LAST mm: Convert pXd_devmap checks to vma_is_dax mm/pagewalk: Skip dax pages in pagewalk mm: Convert vmf_insert_mixed() from using pte_devmap to pte_special mm: Remove remaining uses of PFN_DEV mm/gup: Remove pXX_devmap usage from get_user_pages() mm: Remove redundant pXd_devmap calls mm/khugepaged: Remove redundant pmd_devmap() check powerpc: Remove checks for devmap pages and PMDs/PUDs mm: Remove devmap related functions and page table bits mm: Remove callers of pfn_t functionality mm/memremap: Remove unused devmap_managed_key Documentation/mm/arch_pgtable_helpers.rst | 6 +- arch/arm64/Kconfig | 1 +- arch/arm64/include/asm/pgtable-prot.h | 1 +- arch/arm64/include/asm/pgtable.h | 24 +--- arch/loongarch/Kconfig | 1 +- arch/loongarch/include/asm/pgtable-bits.h | 6 +- arch/loongarch/include/asm/pgtable.h | 19 +-- arch/powerpc/Kconfig | 1 +- arch/powerpc/include/asm/book3s/64/hash-4k.h | 6 +- arch/powerpc/include/asm/book3s/64/hash-64k.h | 7 +- arch/powerpc/include/asm/book3s/64/pgtable.h | 53 +------ arch/powerpc/include/asm/book3s/64/radix.h | 14 +-- arch/powerpc/mm/book3s64/hash_hugepage.c | 2 +- arch/powerpc/mm/book3s64/hash_pgtable.c | 3 +- arch/powerpc/mm/book3s64/hugetlbpage.c | 2 +- arch/powerpc/mm/book3s64/pgtable.c | 10 +- arch/powerpc/mm/book3s64/radix_pgtable.c | 5 +- arch/powerpc/mm/pgtable.c | 2 +- arch/riscv/Kconfig | 1 +- arch/riscv/include/asm/pgtable-64.h | 20 +-- arch/riscv/include/asm/pgtable-bits.h | 1 +- arch/riscv/include/asm/pgtable.h | 17 +-- arch/x86/Kconfig | 1 +- arch/x86/include/asm/pgtable.h | 51 +------ arch/x86/include/asm/pgtable_types.h | 5 +- arch/x86/mm/pat/memtype.c | 6 +- drivers/dax/device.c | 23 +-- drivers/dax/hmem/hmem.c | 1 +- drivers/dax/kmem.c | 1 +- drivers/dax/pmem.c | 1 +- drivers/dax/super.c | 3 +- drivers/gpu/drm/exynos/exynos_drm_gem.c | 1 +- drivers/gpu/drm/gma500/fbdev.c | 3 +- drivers/gpu/drm/i915/gem/i915_gem_mman.c | 1 +- drivers/gpu/drm/msm/msm_gem.c | 1 +- drivers/gpu/drm/omapdrm/omap_gem.c | 7 +- drivers/gpu/drm/v3d/v3d_bo.c | 1 +- drivers/md/dm-linear.c | 2 +- drivers/md/dm-log-writes.c | 2 +- drivers/md/dm-stripe.c | 2 +- drivers/md/dm-target.c | 2 +- drivers/md/dm-writecache.c | 9 +- drivers/md/dm.c | 2 +- drivers/nvdimm/pmem.c | 8 +- drivers/nvdimm/pmem.h | 4 +- drivers/s390/block/dcssblk.c | 10 +- drivers/vfio/pci/vfio_pci_core.c | 7 +- fs/cramfs/inode.c | 5 +- fs/dax.c | 55 ++---- fs/ext4/file.c | 2 +- fs/fuse/dax.c | 3 +- fs/fuse/virtio_fs.c | 5 +- fs/userfaultfd.c | 2 +- fs/xfs/xfs_file.c | 2 +- include/linux/dax.h | 9 +- include/linux/device-mapper.h | 2 +- include/linux/huge_mm.h | 19 +-- include/linux/memremap.h | 11 +- include/linux/mm.h | 11 +- include/linux/pfn.h | 9 +- include/linux/pfn_t.h | 131 +--------------- include/linux/pgtable.h | 25 +--- include/trace/events/fs_dax.h | 12 +- mm/Kconfig | 4 +- mm/debug_vm_pgtable.c | 60 +------- mm/gup.c | 162 +------------------- mm/hmm.c | 12 +- mm/huge_memory.c | 98 ++--------- mm/khugepaged.c | 2 +- mm/madvise.c | 8 +- mm/mapping_dirty_helpers.c | 4 +- mm/memory.c | 64 ++------ mm/memremap.c | 28 +--- mm/migrate.c | 1 +- mm/migrate_device.c | 2 +- mm/mprotect.c | 2 +- mm/mremap.c | 5 +- mm/page_vma_mapped.c | 5 +- mm/pagewalk.c | 20 +- mm/pgtable-generic.c | 7 +- mm/userfaultfd.c | 6 +- mm/vmscan.c | 5 +- tools/testing/nvdimm/pmem-dax.c | 6 +- tools/testing/nvdimm/test/iomap.c | 11 +- 84 files changed, 216 insertions(+), 955 deletions(-) delete mode 100644 include/linux/pfn_t.h base-commit: cf42737e247a159abe9b0dc065a3ea44808a83a0 -- git-series 0.9.1