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

Kiryl Shutsemau
2026-04-24T13:50:10Z

On Fri, Apr 24, 2026 at 07:51:44AM -0400, Peter Xu wrote:
> On Fri, Apr 24, 2026 at 11:34:48AM +0100, Kiryl Shutsemau wrote:
> > Both page_idle and the LRUs (legacy or MGLRU) track accesses on physical
> > memory. We need visibility in the virtual address space domain.
>
> Yes they are, but ACCESS bit isn't.

A-bit is not a reliable signal for userspace working-set tracking
because the kernel itself is a concurrent consumer. It is exactly why
page_idle needs PG_young on top of the A-bit: PG_young is the "kernel
ate the A-bit but the page was actually touched" escape hatch. And
bringing PG_young into the picture puts us right back into physical-side
tracking.

> For migration, see e.g. remove_migration_pte() has:
>
> if (!softleaf_is_migration_young(entry))
> pte = pte_mkold(pte);

remove_migration_pte() only propagates young-at-unmap. It does not
cover the common case: A-bit cleared by reclaim before migration
started. The concurrent-consumer problem is what breaks the signal,
not the migration boundary.

--
Kiryl Shutsemau / Kirill A. Shutemov