Re: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

Jason Gunthorpe
2023-07-18T15:36:40Z

On Tue, Jul 18, 2023 at 01:28:56AM -0700, Vivek Kasireddy wrote:
> Currently, there does not appear to be any mechanism for letting
> drivers or other kernel entities know about updates made in a
> mapping particularly when a new page is faulted in. Providing
> notifications for such situations is really useful when using
> memfds backed by ram-based filesystems such as shmem or hugetlbfs
> that also allow FALLOC_FL_PUNCH_HOLE.

Huh? You get an invalidate when this happens and the address becomes
non-present.

> More specifically, when a hole is punched in a memfd (that is
> backed by shmem or hugetlbfs), a driver can register for
> notifications associated with range invalidations. However, it
> would also be useful to have notifications when new pages are
> faulted in as a result of writes made to the mapping region that
> overlaps with a previously punched hole.

If there is no change to the PTEs then it is hard to see why this
would be part of a mmu_notifier.

Jason