Re: [RFC, PATCH 00/12] userfaultfd: working set tracking for VM guest memory

Peter Xu
2026-04-23T20:10:36Z

On Thu, Apr 23, 2026 at 09:25:30PM +0200, David Hildenbrand (Arm) wrote:
> >
> > The other thing is, as I mentioned in the other email, I still don't know
> > how the current RW protection would work for anonymous. I don't yet think
> > the user swapper can read the anon page with RW-protected pgtables. So far
> > my understanding is maybe you only care about shmem so it's fine, but it'll
> > always be great to confirm with you.
>
> I wonder if uffdio_move could be used for a swapper implementation instead?

If RW is justified to be useful first, maybe.

I had a gut feeling Kirill's use case doesn't use anon at all, then if
nobody needs it we can still decide to not support anon.

>
> If we ever have to read from a protnone page, maybe we could teach ptrace access
> to do it, or have something that can read from prot_none areas -- like
> uffdio_copy, which can write to prot-none areas.

Somethinig like swap_access() in my proposal can also partly achieve that.

https://lore.kernel.org/all/aYuad2k75iD9bnBE@x1.local/

There, it was only about reading from swap so far, though. But that one
might be easier to be extended to read PROT_NONE and directly put data into
buffer user specified (ps: in my local tree impl I named it maccess() to
pair with mincore(), but it doesn't really matter; it doesn't even need to
be a syscall..).

To me, the interfacing is not a major issue. The major question I have is
why RW protection can help in swap system impl when we already have uffd-wp.

So I want to make sure the use case can't be implemented by uffd-wp already.
Because that's really what we might do for QEMU.

The other thing is I want to see possibilities of reusing any new kernel
feature that can provide hotness. Currently idle page tracking has issue,
not only about perf and rmap, but also on not working with mglru (defaults
for Fedora/RHEL). If we can split the requirements and solve the hotness
issue, then it'll also be very helpful.

Thanks,

--
Peter Xu