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

Jason Gunthorpe
2023-08-01T18:19:23Z

On Tue, Aug 01, 2023 at 05:53:32PM +0000, Kasireddy, Vivek wrote:

> > Right, the "the zero pages are changed into writable pages" in your
> > above comment just might not apply, because there won't be any page
> > replacement (hopefully :) ).

> If the page replacement does not happen when there are new writes to the
> area where the hole previously existed, then would we still get an invalidate
> when this happens? Is there any other way to get notified when the zeroed
> page is written to if the invalidate does not get triggered?

What David is saying is that memfd does not use the zero page
optimization for hole punches. Any access to the memory, including
read-only access through hmm_range_fault() will allocate unique
pages. Since there is no zero page and no zero-page replacement there
is no issue with invalidations.

Jason