Re: [PATCH v3 13/13] mm/huge_memory: add and use has_deposited_pgtable()

From: David Hildenbrand (Arm)

Date: Tue Apr 14 2026 - 14:24:25 EST


On 4/14/26 17:14, Yin Tirui wrote:
> On 4/14/26 17:44, David Hildenbrand (Arm) wrote:
>>
>> I mean, we need some indication to know also during folio splitting
>> whether we can just discard the PMD, as we can refault it later, or
>> whether we really have to install a PTE table.
>>
>> What if someone used remap_pfn_range() on some part of the VMA, and
>> faults on another part?
>>
>> Doesn't really work.
>>
>> Do we have users of remap_pfn_range() that have ->fault set? If not, we
>> should probably just disallow this combination.
>
> I did a quick tree-wide grep:
> $ git grep -l "remap_pfn_range" | xargs grep -l "\.fault\s*="
> arch/powerpc/platforms/book3s/vas-api.c
> drivers/infiniband/hw/hfi1/file_ops.c
> drivers/uio/uio.c
> drivers/vfio/pci/vfio_pci_core.c
> fs/proc/vmcore.c
> security/selinux/selinuxfs.c
>
> It turns out there are two users of this "hybrid" approach in the kernel:
> 1. fs/proc/vmcore.c: It pre-maps via remap_pfn_range() but registers
> mmap_vmcore_fault().
> 2. arch/powerpc/platforms/book3s/vas-api.c: It pre-maps via
> remap_pfn_range(), but registers vas_mmap_fault().
>
>>
>> Then we know for sure whether something was installed through
>> remap_pfn_range() or through a fault handler.
>>
>
> How would you suggest we proceed here?

How about we populate PMDs in remap_pfn_range() only if !fault?

Then, if we have !fault, we know that the PMD is from remap_pfn_range()
and has a disposed page table.

Would that work?

--
Cheers,

David