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

Kiryl Shutsemau
2026-04-23T18:08:08Z

On Thu, Apr 23, 2026 at 10:50:06AM -0400, Peter Xu wrote:
> Hello, Kiryl,
>
> On Thu, Apr 23, 2026 at 03:27:11PM +0100, Kiryl Shutsemau wrote:
> > The patchet is pretty good shape in my eyes and will probably drop RFC
> > tag.
>
> I still have some high level questions not yet got answered. Do you want
> to answer them?
>
> https://lore.kernel.org/all/ad59TxAHNwFWH7Cc@x1.local/

Sorry, reply to this got lost in my TODO list.

> In summary, it's about:
>
> - Whether we have explored other approaches on page hotness tracking

So, for read/write tracking we have clear_refs=1, page_idle and DAMON.
Did I miss something?

clear_refs is process-wide hammer. And you can miss a hot page if it
races with LRU rotation.

page_idle needs rmap. It will not scale.

DAMON is built around sampling. It is good for working set estimation,
but I don't think it is directly useful for eviction decision. It can
miss hot pages. LRU rotation will also loose info.

None of them gives comparable capabilities.

We also need a mechanism to atomically evict pages.

> - Whether read protection is required for an userspace swap system
> (e.g. did you get time to have a look at umap?)

I looked at it briefly, so I can miss details.

IIUC, in absence of read tracking it doesn't collect hotness information
at all. The eviction is based on fault-in time: the oldest faulted-in
page gets evicted first. I guess it is fine if you don't care much about
refault cost. Like, if your workload fits into memory completely and
refaults are rare.

That's not my case.

--
Kiryl Shutsemau / Kirill A. Shutemov