[PATCH 0/6] mm/damon: support access monitoring of hugetlb-backed memory

From: Krishna Iyer

Date: Sun Aug 30 2026 - 01:14:18 EST


On virtualization hosts, most system memory is often backed by
hugetlbfs. On our production hosts, for example, ~95% of RAM is 1 GiB
hugetlb pages backing guest memory. DAMON's physical address space
monitoring cannot produce a useful access signal for such memory, for
two layered reasons.

First, it is blind to hugetlb folios. Every access check starts at
damon_get_folio(), which rejects folios that are not on the LRU lists,
and hugetlb folios are managed outside of the LRU by design. As a
result, all hugetlb-backed memory is silently reported as never
accessed.

Second, even once hugetlb folios are visible, access-bit-based sampling
under-reports hot memory. DAMON deliberately clears accessed bits
without TLB flushes to keep the overhead low, so accesses served from
cached translations do not walk the page tables and never re-set the
bit. With 1 GiB mappings, translations effectively never leave the
TLBs, pinning the observed access rate to the TLB-refill rate: a
saturating guest is indistinguishable from a nearly idle one.

Patches 1-3 address the visibility problem. The first patch moves
damon_hugetlb_mkold() from vaddr to ops-common as a preparation. The
second patch teaches the folio mkold/young rmap walkers to handle
hugetlb folios, aging the huge PTE and notifying secondary MMUs across
the whole huge page size; the secondary MMU notification is what
surfaces guest-side (e.g., KVM/EPT) accessed bits. The third patch
adds damon_get_folio_incl_hugetlb() and uses it from the paddr
monitoring primitives only. DAMOS action appliers such as
DAMON_RECLAIM and DAMON_LRU_SORT keep the LRU-only lookup and are
behaviorally unchanged.

Patches 4-6 address the intensity problem with a new default-off
monitoring context option, 'aging_flush'. When set, access bit
clearing for monitoring uses the flushing primitives
(mmu_notifier_clear_flush_young() and TLB-flushing PTE/PMD/hugetlb
aging) so that the next access is guaranteed to re-set the accessed
bit. The option is exposed via the DAMON sysfs interface (patch 5) and
as a DAMON_STAT module parameter (patch 6). With the option unset, the
behavior is identical to before this series.

Evaluation on an Intel EPT host running a 944 GiB guest with an 842 GiB
in-guest memory workload (masim):

configuration estimated access rate idle -> load
idle -> load (GB/s) separation
stock 0.08 -> 0.21 none (guest memory
invisible)
patches 1-3 1.70 -> 1.96 1.2x
full series, flush on 1.21 -> 5.34 4.4x

With aging_flush set, the estimated hot footprint covers ~82% of the
actual working set size, compared to ~40% without flushing, where the
signal mostly reflects the ambient TLB-refill rate rather than guest
accesses. kdamond CPU consumption stays approximately 0%, and the
worst-case flush overhead measured is below 0.1%, which is acceptable
for hosts that opt in.

Per Documentation/process/generated-content.rst, this series was
developed with the assistance of an AI coding assistant (Anthropic
Claude, via Claude Code). The assistant helped draft the code and
changelogs, and performed the rebase of the series from its original
6.17-based development tree onto mm-new, including merge conflict
resolution against recent DAMON changes. All changes were reviewed by
the human submitter, who takes full responsibility for the
contribution.

The series as posted here was regression-tested on its base commit
with a full x86_64 kernel build (no new W=1 warnings in mm/damon), the
DAMON kunit suite (41/41 passing) and the DAMON selftests (15/15
passing) on a kernel booted with virtme-ng. Functional validation
(the evaluation above, ftrace verification that the flag switches the
notifier variants, and enable/disable stress testing) was performed by
the submitter on production-like hosts running the 6.17-based backport
of this series.

Krishna Iyer (6):
mm/damon: move damon_hugetlb_mkold() from vaddr to ops-common
mm/damon/ops-common: handle hugetlb folios in folio mkold/young rmap
walkers
mm/damon/paddr: support hugetlb folios in access monitoring
mm/damon: support flush-assisted access bit clearing for monitoring
mm/damon/sysfs: support aging_flush
mm/damon/stat: support aging_flush

include/linux/damon.h | 2 +
mm/damon/core.c | 2 +
mm/damon/ops-common.c | 154 ++++++++++++++++++++++++++++++++++++------
mm/damon/ops-common.h | 18 ++++-
mm/damon/paddr.c | 11 +--
mm/damon/stat.c | 6 ++
mm/damon/sysfs.c | 29 ++++++++
mm/damon/vaddr.c | 46 +++----------
8 files changed, 203 insertions(+), 65 deletions(-)


base-commit: d2aad7fdcda7ae8a726926f2d6de7fe9e8ee7563
--
2.54.0