* [PATCH v1.1 00/17] mm/damon: introduce data access-as-a-data attribute
@ 2026-09-01 13:24 SJ Park
2026-09-01 13:24 ` [PATCH v1.1 04/17] Docs/mm/damon/design: document pgidle_unset probe filter type SJ Park
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: SJ Park @ 2026-09-01 13:24 UTC (permalink / raw)
To: Andrew Morton
Cc: SJ Park, Liam R. Howlett, David Hildenbrand, Jonathan Corbet,
Lorenzo Stoakes, Michal Hocko, Mike Rapoport, Randy Dunlap,
Shuah Khan, Shuah Khan, Suren Baghdasaryan, Vlastimil Babka,
damon, linux-doc, linux-kernel, linux-kselftest, linux-mm
TL;DR: extend DAMON's data attributes monitoring system to support page
table accessed bit and PG_idle based access monitoring.
DAMON was initially introduced as a data access monitor. Users found
data access pattern becomes more useful when it is combined with other
data attributes such as belonging cgroups and backing page types. For
such cases, DAMON has extended to support such data attributes
monitoring in addition to the original data access monitoring. The
DAMON probes system was introduced for this purpose. Users set probes
for filtering data attributes of their interest. For use cases where
the primary interests are the attributes but the access pattern, probe
weights system has been introduced. When it is used, DAMON applies its
adaptive regions adjustment based on the monitored data attributes.
However, DAMON stops access monitoring when the probe weights are used.
DAMON cannot optimally help users who have interests in both data
attributes and access patterns. Data access can also be thought of as
another data attribute, though. Extend the probe system to support data
access as a data attribute.
Introduce a new probe filter type, pgidle_unset. It shows if the page
is not set as idle. Specifically, it shows the page table accessed bit
and the PG_idle flag. It can inform if the region is ever accessed. But
it cannot say when it is accessed. To answer the second question,
introduce a new probe feature, prep actions. Using the features, Users
can specify what preparation actions should be made to each region for
each probe. DAMON executes the preparation actions for each sampling
interval, like it is doing the preparation for access check in the
access monitoring mode. To help 'pgidle_unset' probe action use case,
'set_pgidle' preparation action is introduced together. The action does
exactly what the access monitoring was doing: clearing the page table
accessed bits and setting the PG_idle flags.
Tests
=====
I compared the access pattern monitoring results from the classic way
and the probe based way. As expected, the probe based way shows the
results similar to that of the classic way. More detailed test methods
and results are below.
First, do the access monitoring using the DAMON user-space tool [1] in
the classic way. The system is idle. It shows no access as expected.
$ sudo ./damo/damo start
$ sudo ./damo/damo report access
heatmap:
00000000000000000000000000000000000000008999999811111110000000000000000000000000
# min/max temperatures: -640,000,000, -100,000,000, column size: 99.800
MiB
intervals: sample 5 ms aggr 100 ms (max access hz 200)
0 addr 4.000 KiB size 3.898 GiB access 0 hz age 6.400 s
1 addr 3.898 GiB size 787.301 MiB access 0 hz age 1 s
2 addr 4.667 GiB size 773.457 MiB access 0 hz age 5.800 s
3 addr 5.423 GiB size 2.374 GiB access 0 hz age 6.400 s
memory bw estimate: 0 B per second
total size: 7.797 GiB
record DAMON intervals: sample 5 ms, aggr 100 ms
Start an artificial memory access generator (masim) [2] in another window.
$ ./masim/masim.py run --config_file ./masim/configs/zigzag.cfg
Show the monitoring results. As expected, it captures accesses.
$ sudo ./damo/damo report access
heatmap:
00000000000000000000000000000000000000011111111111111118888888833378988888888888
# min/max temperatures: -1,470,000,000, -12,482,536, column size: 99.800
MiB
intervals: sample 5 ms aggr 100 ms (max access hz 200)
0 addr 4.000 KiB size 1.542 GiB access 0 hz age 14.700 s
1 addr 1.542 GiB size 788.324 MiB access 0 hz age 14.600 s
2 addr 2.311 GiB size 772.844 MiB access 0 hz age 14.200 s
[...]
50 addr 6.839 GiB size 1.742 MiB access 0 hz age 1.300 s
51 addr 6.840 GiB size 8.000 KiB access 100 hz age 0 ns
52 addr 6.840 GiB size 1.496 MiB access 160 hz age 0 ns
[...]
97 addr 7.162 GiB size 1.199 MiB access 40 hz age 400 ms
98 addr 7.163 GiB size 1.199 MiB access 20 hz age 400 ms
99 addr 7.164 GiB size 2.004 MiB access 160 hz age 0 ns
100 addr 7.166 GiB size 646.004 MiB access 0 hz age 400 ms
memory bw estimate: 26.148 GiB per second
total size: 7.797 GiB
record DAMON intervals: sample 5 ms, aggr 100 ms
After the artificial memory access generator (masim) is terminated,
restart DAMON with the probe-based access monitoring. As expected, it
shows no access since the system is idle again.
$ sudo ./damo/damo stop
$ sudo ./damo/damo start --probe_prep set_pgidle \
--probe_filter allow pgidle_unset --probe_weight 1
$ sudo ./damo/damo report attrs
heatmap:
00000000000000000000000000000000000000008999999711111100000000000000000000000000
# min/max temperatures: -600,000,000, -430,000,000, column size: 99.800
MiB
probe prep: set_pgidle, filter: allow pgidle_unset (weight: 1)
intervals: sample 5 ms aggr 100 ms (max probe hits 20)
# addr size age probe_hits
0 4.000 KiB 3.898 GiB 6 s 0
1 5.285 GiB 2.512 GiB 6 s 0
2 4.659 GiB 641.816 MiB 5.700 s 0
3 3.898 GiB 778.375 MiB 4.300 s 0
memory bw estimate: 0 B per second
total size: 7.797 GiB
record DAMON intervals: sample 5 ms, aggr 100 ms
Start the artificial memory access generator [2] again.
$ ./masim/masim.py run --config_file ./masim/configs/zigzag.cfg
Show the monitoring results. As expected, it captures accesses similar
to the classic monitoring mode.
$ sudo ./damo/damo report attrs
heatmap:
00000000000000000000000000000000000000011111110000000177777777777777878798887777
# min/max temperatures: -1,330,000,000, 84,847,514, column size: 99.800
MiB
probe prep: set_pgidle, filter: allow pgidle_unset (weight: 1)
intervals: sample 5 ms aggr 100 ms (max probe hits 20)
# addr size age probe_hits
0 4.000 KiB 1.508 GiB 13.300 s 0
1 1.508 GiB 794.684 MiB 13.200 s 0
2 2.284 GiB 764.555 MiB 13 s 0
[...]
50 6.711 GiB 4.625 MiB 0 ns 17
51 6.716 GiB 2.504 MiB 0 ns 17
52 6.732 GiB 796.000 KiB 0 ns 17
[...]
90 7.162 GiB 512.000 KiB 2.200 s 2
91 7.061 GiB 700.000 KiB 2.300 s 1
92 6.935 GiB 316.000 KiB 2.300 s 4
memory bw estimate: 0 B per second
total size: 7.797 GiB
record DAMON intervals: sample 5 ms, aggr 100 ms
Patches Sequence
================
First four patches (patches 1-4) introduce the new probe filter type for
knowing if a region is accessed. Patch 1 defines the new type in the
core. Patch 2 implements the execution of the new filter in the
physical address space DAMON operation set. Patch 3 implements a user
interface on DAMON sysfs interface. Patch 4 updates the documentation
for the new filter type.
Following 13 patches (patches 5-17) introduce the probe preparation
actions feature. Patch 5 defines the data structure for specifying the
preparation actions. Patch 6 completes setup of the API parameter for
the prep. Patch 7 extends the DAMON operation set callback list to
connect the parameter with the underlying operation set. Patch 8
implements the execution of the prep in the physical address space DAMON
operation set.
Following five patches (patches 9-13) extends DAMON sysfs interface for
the new prep feature. Patch 14 adds simple selftest for basic file
operations of the new sysfs files. Final three patches (patches 15-17)
respectively update design, usage and ABI documents for the new feature
and its interface.
[1] https://github.com/damonitor/damo
[2] https://github.com/sjp38/masim
Changelog
=========
Changes from v1
- v1: https://lore.kernel.org/20260901043417.2165-1-sj@kernel.org
- Fix the race between the prep action sysfs write and the context build.
Changes from RFC v2.2
- RFC v2.2: https://lore.kernel.org/20260728041242.187380-1-sj@kernel.org
- Update test results with latest version of damo and masim.
- Drop RFC tag.
- Rebase to latest mm-new.
Changes from RFC v2.1
- RFC v2.1: https://lore.kernel.org/20260727143829.86236-1-sj@kernel.org
- Evaluate ops.prep_probes first for do_prep.
- Rebase to the latest mm-new.
Changes from RFC v2
- RFC v2: https://lore.kernel.org/20260726173935.94046-1-sj@kernel.org
- Rename prep iterator macro param names to make more sense.
- Document set_samples param of prep_probes().
- Set do_prep after kdamond_wait_activation().
- Use const keyword for sysfs prep action-name structure fields.
- Fix typos in documents.
- Restructure sysfs interface patches for no build warning.
- Rebase to the latest mm-new.
Changes from RFC v1
- RFC v1: https://lore.kernel.org/20260725210225.129944-1-sj@kernel.org
- Fix wrong sample_addr setup condition.
- Fix build warnings from sysfs part.
- Fix typos.
- Rebase to latest mm-new.
- Add the tests section to the cover letter.
SJ Park (17):
mm/damon/core: introduce DAMON_FILTER_TYPE_PGIDLE_UNSET
mm/damon/paddr: support PGIDLE_UNSET probe filter type
mm/damon/sysfs: support pgidle_unset probe filter type
Docs/mm/damon/design: document pgidle_unset probe filter type
mm/damon/core: introduce damon_prep struct
mm/damon/core: commit preps
mm/damon/core: introduce damon_operations->prep_probes()
mm/damon/paddr: support damon_prep
mm/damon/sysfs: implement preps directory
mm/damon/sysfs: implement preps/nr_preps file
mm/damon/sysfs: create directories for nr_preps writes
mm/damon/sysfs: implement prep_action file
mm/damon/sysfs: pass preps to DAMON core
selftests/damon/sysfs.sh: test probe prep sysfs files
Docs/mm/damon/design: document probe preps
Docs/admin-guide/mm/damon/usage: document probe preps sysfs files
Docs/ABI/damon: document probe prep sysfs files
.../ABI/testing/sysfs-kernel-mm-damon | 13 +
Documentation/admin-guide/mm/damon/usage.rst | 18 +-
Documentation/mm/damon/design.rst | 15 +-
include/linux/damon.h | 43 ++-
mm/damon/core.c | 105 ++++++-
mm/damon/paddr.c | 41 +++
mm/damon/sysfs.c | 283 +++++++++++++++++-
tools/testing/selftests/damon/sysfs.sh | 27 ++
8 files changed, 531 insertions(+), 14 deletions(-)
base-commit: d153c4c92de32f97b155e3b6418c29094f81b99f
--
2.47.3
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v1.1 04/17] Docs/mm/damon/design: document pgidle_unset probe filter type
2026-09-01 13:24 [PATCH v1.1 00/17] mm/damon: introduce data access-as-a-data attribute SJ Park
@ 2026-09-01 13:24 ` SJ Park
2026-09-01 13:25 ` [PATCH v1.1 15/17] Docs/mm/damon/design: document probe preps SJ Park
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: SJ Park @ 2026-09-01 13:24 UTC (permalink / raw)
To: Andrew Morton
Cc: SJ Park, Liam R. Howlett, 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 pgidle_unset probe
filter type. Also use a list for the types, as it becomes not very easy
to read the whole types in a simple sentence.
Signed-off-by: SJ Park <sj@kernel.org>
---
Documentation/mm/damon/design.rst | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/Documentation/mm/damon/design.rst b/Documentation/mm/damon/design.rst
index 63cbb7b536da2..947d91ae24a39 100644
--- a/Documentation/mm/damon/design.rst
+++ b/Documentation/mm/damon/design.rst
@@ -293,8 +293,12 @@ registration is made by specifying a probe per attribute. Each of the probe
specifies a rule to determine if a given memory region has the related
attribute. The rule is constructed with multiple filters. The filters work
same to :ref:`DAMOS filters <damon_design_damos_filters>` except the supported
-filter types. Currently only ``anon`` and ``memcg`` filter types are supported
-for data attributes monitoring.
+filter types. Currently below filter types are supported.
+
+- ``anon``: Same to that for DAMOS filters.
+- ``memcg``: Same to that for DAMOS filters.
+- ``pgidle_unset``: Matches if the page for the memory is marked as not
+ access-idle.
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] 6+ messages in thread
* [PATCH v1.1 15/17] Docs/mm/damon/design: document probe preps
2026-09-01 13:24 [PATCH v1.1 00/17] mm/damon: introduce data access-as-a-data attribute SJ Park
2026-09-01 13:24 ` [PATCH v1.1 04/17] Docs/mm/damon/design: document pgidle_unset probe filter type SJ Park
@ 2026-09-01 13:25 ` SJ Park
2026-09-01 13:25 ` [PATCH v1.1 16/17] Docs/admin-guide/mm/damon/usage: document probe preps sysfs files SJ Park
2026-09-01 17:18 ` [PATCH v1.1 00/17] mm/damon: introduce data access-as-a-data attribute Andrew Morton
3 siblings, 0 replies; 6+ messages in thread
From: SJ Park @ 2026-09-01 13:25 UTC (permalink / raw)
To: Andrew Morton
Cc: SJ Park, Liam R. Howlett, 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 DAMON probe preps
feature.
Signed-off-by: SJ Park <sj@kernel.org>
---
Documentation/mm/damon/design.rst | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/Documentation/mm/damon/design.rst b/Documentation/mm/damon/design.rst
index 947d91ae24a39..d036340dae8af 100644
--- a/Documentation/mm/damon/design.rst
+++ b/Documentation/mm/damon/design.rst
@@ -309,6 +309,13 @@ Users can therefore know how much of a given DAMON region has a specific data
attribute by reading the per-region per-probe probe hits counter after each
aggregation interval.
+Users can optionally register probing preparation actions per probe. If such
+actions are registered, DAMON applies the actions to each region's sampling
+memory before starting the next sampling interval. Currently only one action,
+``set_pgidle`` is supported. The action marks the page for the probing target
+memory as access-idle. This can be useful to be used together with
+``pgidle_unset`` probe filter.
+
This is a sampling based mechanism. Hence, it is lightweight but the output
may include some measurement errors. The output should be used with good
understanding of statistics.
--
2.47.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v1.1 16/17] Docs/admin-guide/mm/damon/usage: document probe preps sysfs files
2026-09-01 13:24 [PATCH v1.1 00/17] mm/damon: introduce data access-as-a-data attribute SJ Park
2026-09-01 13:24 ` [PATCH v1.1 04/17] Docs/mm/damon/design: document pgidle_unset probe filter type SJ Park
2026-09-01 13:25 ` [PATCH v1.1 15/17] Docs/mm/damon/design: document probe preps SJ Park
@ 2026-09-01 13:25 ` SJ Park
2026-09-01 17:18 ` [PATCH v1.1 00/17] mm/damon: introduce data access-as-a-data attribute Andrew Morton
3 siblings, 0 replies; 6+ messages in thread
From: SJ Park @ 2026-09-01 13:25 UTC (permalink / raw)
To: Andrew Morton
Cc: SJ Park, Liam R. Howlett, 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 DAMON probe preps sysfs
files.
Signed-off-by: SJ Park <sj@kernel.org>
---
Documentation/admin-guide/mm/damon/usage.rst | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/Documentation/admin-guide/mm/damon/usage.rst b/Documentation/admin-guide/mm/damon/usage.rst
index da5f9afd08aef..023c6334024f8 100644
--- a/Documentation/admin-guide/mm/damon/usage.rst
+++ b/Documentation/admin-guide/mm/damon/usage.rst
@@ -74,6 +74,9 @@ comma (",").
│ │ │ │ │ │ nr_regions/min,max
│ │ │ │ │ │ :ref:`probes <damon_usage_sysfs_probes>`/nr_probes
│ │ │ │ │ │ │ 0/weight
+ │ │ │ │ │ │ │ │ preps/nr_preps
+ │ │ │ │ │ │ │ │ │ 0/prep_action
+ │ │ │ │ │ │ │ │ │ ...
│ │ │ │ │ │ │ │ filters/nr_filters
│ │ │ │ │ │ │ │ │ 0/type,matching,allow,path
│ │ │ │ │ │ │ │ │ ...
@@ -283,9 +286,18 @@ In the beginning, this directory has only one file, ``nr_probes``. Writing a
number (``N``) to the file creates the number of child directories named ``0``
to ``N-1``. Each directory represents each monitoring probe.
-In each probe directory, one directory, ``filters`` exists. The directory
-contains files for installing filters for the probe, that is used to determine
-the data attribute for the probe.
+In each probe directory, two directories, ``preps`` and ``filters`` exist. The
+directories contain files for installing probing preparation actions and
+filters for the probe, that are used to determine the data attribute for the
+probe.
+
+In the beginning, ``preps`` directory has only one file, ``nr_preps``.
+Writing a number (``N``) to the file creates the number of child directories
+named ``0`` to ``N-1``. Each directory represents each preparation action.
+Each directory has one file, ``prep_action``. The preparation action can be
+selected by writing the name of the action to the ``prep_action`` file. Refer
+to the :ref:`design doc <damon_design_data_attrs_monitoring>` for the list of
+supported actions.
Each probe directory also contains ``weight`` file. Reading from and writing
to the file gets and sets the :ref:`attributes-only monitoring
--
2.47.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v1.1 00/17] mm/damon: introduce data access-as-a-data attribute
2026-09-01 13:24 [PATCH v1.1 00/17] mm/damon: introduce data access-as-a-data attribute SJ Park
` (2 preceding siblings ...)
2026-09-01 13:25 ` [PATCH v1.1 16/17] Docs/admin-guide/mm/damon/usage: document probe preps sysfs files SJ Park
@ 2026-09-01 17:18 ` Andrew Morton
2026-09-01 23:52 ` SJ Park
3 siblings, 1 reply; 6+ messages in thread
From: Andrew Morton @ 2026-09-01 17:18 UTC (permalink / raw)
To: SJ Park
Cc: Liam R. Howlett, David Hildenbrand, Jonathan Corbet,
Lorenzo Stoakes, Michal Hocko, Mike Rapoport, Randy Dunlap,
Shuah Khan, Shuah Khan, Suren Baghdasaryan, Vlastimil Babka,
damon, linux-doc, linux-kernel, linux-kselftest, linux-mm
On Tue, 1 Sep 2026 06:24:47 -0700 SJ Park <sj@kernel.org> wrote:
> TL;DR: extend DAMON's data attributes monitoring system to support page
> table accessed bit and PG_idle based access monitoring.
>
Thanks, added.
What does "v1.1" mean?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1.1 00/17] mm/damon: introduce data access-as-a-data attribute
2026-09-01 17:18 ` [PATCH v1.1 00/17] mm/damon: introduce data access-as-a-data attribute Andrew Morton
@ 2026-09-01 23:52 ` SJ Park
0 siblings, 0 replies; 6+ messages in thread
From: SJ Park @ 2026-09-01 23:52 UTC (permalink / raw)
To: Andrew Morton
Cc: SJ Park, Liam R. Howlett, David Hildenbrand, Jonathan Corbet,
Lorenzo Stoakes, Michal Hocko, Mike Rapoport, Randy Dunlap,
Shuah Khan, Shuah Khan, Suren Baghdasaryan, Vlastimil Babka,
damon, linux-doc, linux-kernel, linux-kselftest, linux-mm
On Tue, 1 Sep 2026 10:18:00 -0700 Andrew Morton <akpm@linux-foundation.org> wrote:
> On Tue, 1 Sep 2026 06:24:47 -0700 SJ Park <sj@kernel.org> wrote:
>
> > TL;DR: extend DAMON's data attributes monitoring system to support page
> > table accessed bit and PG_idle based access monitoring.
> >
>
> Thanks, added.
Thank you Andrew!
>
> What does "v1.1" mean?
Sashiko found a low priority issue on the previous version. Before the Sashiko
era, it would be fixed by posting a fixup as a reply to the thread and asking
Andrew to handle it. But that cannot get review from Sashiko. So I did
reposting of the series, but with minor version update. I use this kind of
version scheme nowadays. If it makes someone be confused, please let me know.
I will be happy to adapt.
Thanks,
SJ
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-09-01 23:53 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-01 13:24 [PATCH v1.1 00/17] mm/damon: introduce data access-as-a-data attribute SJ Park
2026-09-01 13:24 ` [PATCH v1.1 04/17] Docs/mm/damon/design: document pgidle_unset probe filter type SJ Park
2026-09-01 13:25 ` [PATCH v1.1 15/17] Docs/mm/damon/design: document probe preps SJ Park
2026-09-01 13:25 ` [PATCH v1.1 16/17] Docs/admin-guide/mm/damon/usage: document probe preps sysfs files SJ Park
2026-09-01 17:18 ` [PATCH v1.1 00/17] mm/damon: introduce data access-as-a-data attribute Andrew Morton
2026-09-01 23:52 ` SJ Park
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox