* [RFC PATCH 0/8] mm/damon: introduce hugepage_size probe filter
@ 2026-09-13 17:11 SJ Park
2026-09-13 17:11 ` [RFC PATCH 6/8] Docs/mm/damon/design: update for " SJ Park
2026-09-13 17:11 ` [RFC PATCH 7/8] Docs/admin-guide/mm/damon/usage: update for hugepage_size SJ Park
0 siblings, 2 replies; 3+ messages in thread
From: SJ Park @ 2026-09-13 17:11 UTC (permalink / raw)
Cc: SJ Park, Liam R. Howlett, Andrew Morton, David Hildenbrand,
Jonathan Corbet, Lorenzo Stoakes, Michal Hocko, Mike Rapoport,
Randy Dunlap, Shuah Khan, Suren Baghdasaryan, Vlastimil Babka,
damon, linux-doc, linux-kernel, linux-mm
Knowing whether a given memory is backed by a hugepage of specific size
is useful for efficient utilization of hugepages. For easy monitoring
of the information, introduce a new data attribute probe filter type,
hugepage_size. It works similar to the DAMOS filter of the same name.
It works for memory that is backed by a hugepage of a given size range.
Patch 1 introduces the new probe filter type to DAMON API and extends
related data structures. Patch 2 updates probe filter commit logic to
handle the size range. Patch 3 Updates the filtering logic to support
the new type. Patch 4 adds new DAMON sysfs files for the size range.
Patch 5 updates DAMON sysfs interface to fully support the new filter
type. Patches 6-8 updates design, usage and ABI documents for the new
feature.
Test
====
Set THP always and start a test workload using masim [1].
$ echo always | sudo tee /sys/kernel/mm/transparent_hugepage/enabled
$ ./masim.py run --config_file ./configs/stairs-500mb.cfg --repeat 10
Using the DAMON user-space tool, damo [2], start DAMON with two probes.
The primary probe monitors access. The secondary probe monitors 2 MiB
sized hugepages. The region adjustment weight is given to only the
primary probe. That is, this setup is for showing access temperature
and additionally how many 2 MiB hugepages are being used for the region
of the access temperature.
$ sudo ./damo start $(pidof masim) \
--probe_prep set_pgidle --probe_filter allow pgidle_unset \
--probe_filter allow hugepage_size 2M 2M --probe_weight 1 0 \
--nr_probe_preps 1 0 --nr_probe_filters 1 1 --nr_probes 2
Show the monitoring results.
$ sudo ./damo report attrs
heatmap: 000004[...]666666668988888888888844444430000000000000000000000000000000000000000000014[...]8
# min/max temperatures: -470,000,000, 10,000,500, column size: 64.119 MiB
probes
- prep: set_pgidle, filter: allow pgidle_unset (weight: 1)
- allow hugepage_size [2.000 MiB, 2.000 MiB] (weight: 0)
intervals: sample 5 ms aggr 100 ms (max probe hits 20)
# size address age probe_hits
0 354.039 MiB 85.833 TiB 4.700 s 0 0
1 1.843 GiB 127.724 TiB 4.700 s 0 6
2 936.781 MiB 127.726 TiB 4.600 s 0 16
[...]
25 44.000 KiB 127.723 TiB 0 ns 15 20
26 11.492 MiB 127.723 TiB 0 ns 16 20
27 2.160 MiB 127.723 TiB 0 ns 19 20
[...]
47 376.000 KiB 127.723 TiB 300 ms 1 20
48 48.000 KiB 127.723 TiB 400 ms 2 20
49 812.000 KiB 127.723 TiB 500 ms 9 20
memory bw estimate: 0 B per second
total size: 5.009 GiB
record DAMON intervals: sample 5 ms, aggr 100 ms
The first probe_hits count and the age show the access temperature of
each region. The second probe_hits count shows the ratio of 2 MiB
hugepages in the region.
For example, region 2, which has 936 MiB size, is quite cold (not
accessed for 4.6 seconds) but uses 2 MiB THP for ~80% (16/20) of the
region. Maybe not a very efficient use of THP.
On the other hand, region 49, which is 812 KiB size, is somewhat hot
(accessed about 9 times per 100 ms for the last 500 ms) and fully backed
by 2 MiB hugepage. Maybe this is a good use of THP.
[1] https://github.com/sjp38/masim
[2] https://github.com/damonitor/damo
SJ Park (8):
mm/damon/api: introduce DAMON_FILTER_TYPE_HUGEPAGE_SIZE
mm/damon/core: commit hugepage_size type damon filter
mm/damon/ops-common: support hugepage_size damon filter matching
mm/damon/sysfs: add min,max files under probe filter directory
mm/damon/sysfs: support hugepage_size probe filter
Docs/mm/damon/design: update for hugepage_size probe filter
Docs/admin-guide/mm/damon/usage: update for hugepage_size
Docs/ABI/damon: update for hugepage_size probe filter
.../ABI/testing/sysfs-kernel-mm-damon | 14 +++++
Documentation/admin-guide/mm/damon/usage.rst | 4 +-
Documentation/mm/damon/design.rst | 2 +
include/linux/damon.h | 8 +++
mm/damon/core.c | 20 +++++--
mm/damon/ops-common.c | 10 ++++
mm/damon/sysfs.c | 55 +++++++++++++++++++
7 files changed, 107 insertions(+), 6 deletions(-)
base-commit: 91c120b49e83b867e29684fd229c3e1f07190071
--
2.47.3
^ permalink raw reply [flat|nested] 3+ messages in thread
* [RFC PATCH 6/8] Docs/mm/damon/design: update for hugepage_size probe filter
2026-09-13 17:11 [RFC PATCH 0/8] mm/damon: introduce hugepage_size probe filter SJ Park
@ 2026-09-13 17:11 ` SJ Park
2026-09-13 17:11 ` [RFC PATCH 7/8] Docs/admin-guide/mm/damon/usage: update for hugepage_size SJ Park
1 sibling, 0 replies; 3+ messages in thread
From: SJ Park @ 2026-09-13 17:11 UTC (permalink / raw)
Cc: SJ Park, Liam R. Howlett, Andrew Morton, David Hildenbrand,
Jonathan Corbet, Lorenzo Stoakes, Michal Hocko, Mike Rapoport,
Randy Dunlap, Shuah Khan, Suren Baghdasaryan, Vlastimil Babka,
damon, linux-doc, linux-kernel, linux-mm
Update DAMON design document for the newly added hugepage_size data
attribute probe filter type.
Signed-off-by: SJ Park <sj@kernel.org>
---
Documentation/mm/damon/design.rst | 2 ++
1 file changed, 2 insertions(+)
diff --git a/Documentation/mm/damon/design.rst b/Documentation/mm/damon/design.rst
index 707170bcd1b33..0a86792f90a18 100644
--- a/Documentation/mm/damon/design.rst
+++ b/Documentation/mm/damon/design.rst
@@ -300,6 +300,8 @@ filter types. Currently below filter types are supported.
- ``pgidle_unset``: Matches if the page for the memory is marked as not
access-idle.
- ``pgidle_set``: Matches if the page for the memory is marked as access-idle.
+- ``hugepage_size``: Matches if the page for the memory is a part of a hugepage
+ of a given size range.
If such probes are registered, DAMON executes the probes for each region's
sampling memory when it does the access :ref:`sampling
--
2.47.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [RFC PATCH 7/8] Docs/admin-guide/mm/damon/usage: update for hugepage_size
2026-09-13 17:11 [RFC PATCH 0/8] mm/damon: introduce hugepage_size probe filter SJ Park
2026-09-13 17:11 ` [RFC PATCH 6/8] Docs/mm/damon/design: update for " SJ Park
@ 2026-09-13 17:11 ` SJ Park
1 sibling, 0 replies; 3+ messages in thread
From: SJ Park @ 2026-09-13 17:11 UTC (permalink / raw)
Cc: SJ Park, Liam R. Howlett, Andrew Morton, David Hildenbrand,
Jonathan Corbet, Lorenzo Stoakes, Michal Hocko, Mike Rapoport,
Randy Dunlap, Shuah Khan, Suren Baghdasaryan, Vlastimil Babka,
damon, linux-doc, linux-kernel, linux-mm
Update DAMON usage document for the newly added hugepage_size data
attribute filter type.
Signed-off-by: SJ Park <sj@kernel.org>
---
Documentation/admin-guide/mm/damon/usage.rst | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/Documentation/admin-guide/mm/damon/usage.rst b/Documentation/admin-guide/mm/damon/usage.rst
index d3e37400367bd..6b80bce5d678d 100644
--- a/Documentation/admin-guide/mm/damon/usage.rst
+++ b/Documentation/admin-guide/mm/damon/usage.rst
@@ -78,7 +78,7 @@ comma (",").
│ │ │ │ │ │ │ │ │ 0/prep_action
│ │ │ │ │ │ │ │ │ ...
│ │ │ │ │ │ │ │ filters/nr_filters
- │ │ │ │ │ │ │ │ │ 0/type,matching,allow,path
+ │ │ │ │ │ │ │ │ │ 0/type,matching,allow,path,min,max
│ │ │ │ │ │ │ │ │ ...
│ │ │ │ │ │ │ ...
│ │ │ │ │ :ref:`targets <sysfs_targets>`/nr_targets
@@ -308,6 +308,8 @@ Writing a number (``N``) to the file creates the number of child directories
named ``0`` to ``N-1``. Each directory represents each filter and works in a
way similar to that for :ref:`DAMOS filter <sysfs_filters>`. When the filter
``type`` is ``memcg``, ``path`` file acts as ``memcg_path`` for :ref:`DAMOS
+filter <sysfs_filters>`. When the filter ``type`` is ``hugepage_size``,
+``min`` and ``max`` files acts as files of the same names for :ref:`DAMOS
filter <sysfs_filters>`.
.. _sysfs_targets:
--
2.47.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-09-13 17:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-13 17:11 [RFC PATCH 0/8] mm/damon: introduce hugepage_size probe filter SJ Park
2026-09-13 17:11 ` [RFC PATCH 6/8] Docs/mm/damon/design: update for " SJ Park
2026-09-13 17:11 ` [RFC PATCH 7/8] Docs/admin-guide/mm/damon/usage: update for hugepage_size SJ Park
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox