From: Alistair Popple <apop...@nvidia.com> Sent: Wednesday, May 28, 2025 11:32 PM > > All PFN_* pfn_t flags have been removed. Therefore there is no longer > a need for the pfn_t type and all uses can be replaced with normal > pfns. > > Signed-off-by: Alistair Popple <apop...@nvidia.com> > Reviewed-by: Christoph Hellwig <h...@lst.de> > --- > 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 | 6 +-- > drivers/gpu/drm/v3d/v3d_bo.c | 1 +- > drivers/hwtracing/intel_th/msu.c | 3 +- > 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 | 11 +-- > drivers/md/dm.c | 2 +- > drivers/nvdimm/pmem.c | 8 +-- > drivers/nvdimm/pmem.h | 4 +- > drivers/s390/block/dcssblk.c | 9 +-- > drivers/vfio/pci/vfio_pci_core.c | 5 +- > fs/cramfs/inode.c | 5 +- > fs/dax.c | 50 +++++++-------- > fs/ext4/file.c | 2 +- > fs/fuse/dax.c | 3 +- > fs/fuse/virtio_fs.c | 5 +- > fs/xfs/xfs_file.c | 2 +- > include/linux/dax.h | 9 +-- > include/linux/device-mapper.h | 2 +- > include/linux/huge_mm.h | 6 +- > include/linux/mm.h | 4 +- > include/linux/pfn.h | 9 +--- > include/linux/pfn_t.h | 85 +------------------------- > include/linux/pgtable.h | 4 +- > include/trace/events/fs_dax.h | 12 +--- > mm/debug_vm_pgtable.c | 1 +- > mm/huge_memory.c | 27 +++----- > mm/memory.c | 31 ++++----- > mm/memremap.c | 1 +- > mm/migrate.c | 1 +- > tools/testing/nvdimm/pmem-dax.c | 6 +- > tools/testing/nvdimm/test/iomap.c | 7 +-- > tools/testing/nvdimm/test/nfit_test.h | 1 +- > 45 files changed, 121 insertions(+), 250 deletions(-) > delete mode 100644 include/linux/pfn_t.h >
[snip] > diff --git a/include/linux/mm.h b/include/linux/mm.h > index c5345ee..12d9665 100644 > --- a/include/linux/mm.h > +++ b/include/linux/mm.h > @@ -3644,9 +3644,9 @@ vm_fault_t vmf_insert_pfn(struct vm_area_struct *vma, > unsigned long addr, > vm_fault_t vmf_insert_pfn_prot(struct vm_area_struct *vma, unsigned long > addr, > unsigned long pfn, pgprot_t pgprot); > vm_fault_t vmf_insert_mixed(struct vm_area_struct *vma, unsigned long addr, > - pfn_t pfn); > + unsigned long pfn); > vm_fault_t vmf_insert_mixed_mkwrite(struct vm_area_struct *vma, > - unsigned long addr, pfn_t pfn); > + unsigned long addr, unsigned long pfn); > int vm_iomap_memory(struct vm_area_struct *vma, phys_addr_t start, unsigned > long len); > > static inline vm_fault_t vmf_insert_page(struct vm_area_struct *vma, [snip] > diff --git a/mm/memory.c b/mm/memory.c > index 6b03771..4eaf444 100644 > --- a/mm/memory.c > +++ b/mm/memory.c > @@ -2635,7 +2634,7 @@ EXPORT_SYMBOL(vmf_insert_mixed); > * the same entry was actually inserted. > */ > vm_fault_t vmf_insert_mixed_mkwrite(struct vm_area_struct *vma, > - unsigned long addr, pfn_t pfn) > + unsigned long addr, unsigned long pfn) > { > return __vm_insert_mixed(vma, addr, pfn, true); > } vmf_insert_mixed_mkwrite() is not used anywhere in the kernel. The commit message for cd1e0dac3a3e suggests it was originally used by DAX code, so presumably it could just go away. On the flip side, I have a patch set in flight (see Patch 3 of [1]) that uses it to do mkwrite on a special PTE, and my usage requires passing PFN_SPECIAL in order to pass the tests in vm_mixed_ok(). But this may be dubious usage, and should not be a blocker to your elimination of pfn_t. I'll either add vmf_insert_special_mkwrite() or figure out an equivalent. Anyone with suggestions in that direction would be appreciated as I'm not an mm expert. Michael [1] https://lore.kernel.org/linux-hyperv/20250523161522.409504-1-mhkli...@outlook.com/