[RFC PATCH v1 0/4] mm/damon: Introduce a huge page collapsing mechanism using auto tuning
From: gutierrez.asier
Date: Thu Apr 30 2026 - 09:44:40 EST
From: Asier Gutierrez <gutierrez.asier@xxxxxxxxxxxxxxxxxxx>
Overview
================
This patch set introduces a new autotuning which allows to collapse
hot regions into hugepages.
Motivation
================
Since TLB is a bottleneck for many systems, a way to optimize TLB
misses (or hits) is to use huge pages. Unfortunately, using "always"
in THP leads to memory fragmentation and memory waste. For this reason,
most application guides and system administrators suggest to disable THP.
Solution
================
A new autotuning quota goal[1], damos_get_used_hugepage_mem_bp, is
introduced, which checks the huge page consumption to total anonymous
memory consumption. This new quota mechanism reuses current autotuning
architecture.
A new module is introduced to demonstrate the use of huge pages
collapse autotuning. The module launches a kdamond thread for a
certain task provided by the user through monitored_pid module argument.
This module also has a user autotuning knob which allows the user to
adjust the aggressiveness of page collapsing.
Benchmarks
================
In progress, will add them in the next RFC series.
TODO
================
- Since DAMOS_COLLAPSE is not in upstream and this is just a
RFC, I have used DAMOS_HUGEPAGE instead. This will change
to DAMOS_COLLAPSE in future series.
Patches Sequence
================
Patch 1 -> damon_modules_new_vaddr_ctx_target
Patch 2 -> Introduce DAMOS_QUOTA_HUGEPAGE and autotuning
Patch 3 -> Module that demonstrates how to use DAMOS_QUOTA_HUGEPAGE
and the new VADDR ctx creation
Patch 4 -> Documentation
[1] https://lore.kernel.org/e67f05ad-dbb9-45e6-ba30-b167a99ac67d@xxxxxxxxxxxxxxxxxxx
.../admin-guide/mm/damon/hugepage.rst (new) | 258 +++++++++++++
Documentation/admin-guide/mm/damon/index.rst | 1 +
include/linux/damon.h | 1 +
mm/damon/Kconfig | 7 +
mm/damon/Makefile | 1 +
mm/damon/core.c | 15 +
mm/damon/hugepage.c (new) | 341 ++++++++++++++++++
mm/damon/modules-common.c | 33 +-
mm/damon/modules-common.h | 3 +
9 files changed, 652 insertions(+), 8 deletions(-)
create mode 100644 Documentation/admin-guide/mm/damon/hugepage.rst
create mode 100644 mm/damon/hugepage.c
--
2.43.0