* [PATCH v3 0/6] mm/damon: add sz_ops_filter_passed_last DAMOS stat
@ 2026-11-23 15:13 SJ Park
2026-11-23 15:13 ` [PATCH v3 4/6] Docs/mm/damon/design: update for sz_ops_filter_passed_last SJ Park
2026-11-23 15:13 ` [PATCH v3 5/6] Docs/admin-guide/mm/damon/usage: " SJ Park
0 siblings, 2 replies; 3+ messages in thread
From: SJ Park @ 2026-11-23 15:13 UTC (permalink / raw)
To: Andrew Morton
Cc: SJ Park, Brendan Higgins, David Gow, Jonathan Corbet,
Randy Dunlap, Shuah Khan, damon, kunit-dev, linux-doc,
linux-kselftest, linux-mm
From: Mattathias Pinchover <mattathias.pinchover@uber.com>
DAMOS stat sz_ops_filter_passed shows the total bytes that passed
operations layer-handled DAMOS filters, accumulated from the beginning
of the scheme's execution. Users who want the amount for only the
latest apply interval, e.g., the size of a workload's anonymous memory
that is cold as of now, have to keep the previous value in user space
and compute the difference. To know how many apply intervals a
difference covers, they have to rely on nr_snapshots. But nr_snapshots
is increased once per target per apply interval, so the computation is
complicated for contexts having multiple targets.
This series introduces a new DAMOS stat, sz_ops_filter_passed_last. It
shows the amount of sz_ops_filter_passed increase in the last apply
interval of the scheme. It is updated at the end of each apply
interval, and kept unchanged until the next apply interval is
completed. Like the other DAMOS stats, it is exposed under the stats/
directory of the scheme in the DAMON sysfs interface, and refreshed
together with the other stats when refresh_ms expires or
update_schemes_stats is written.
Patches sequence
================
Patch 1 introduces the stat to the DAMON core. Patch 2 exposes it via
the DAMON sysfs interface. Patch 3 adds a kunit test. Patches 4-6
update the design, usage, and ABI documents, respectively.
Tests
=====
I ran the DAMON kunit tests (all 50 pass, including the new one), built
mm/damon/ with W=1 (no warnings), built htmldocs (no new warnings
compared to mm-new), and ran checkpatch.pl --strict on the patches (it
reports a warning and an error on each patch because it does not
recognize the Assisted-by tag, and four alignment checks on patches 2
and 3 for the continuation line alignment that the existing DAMON code
uses).
I also ran the DAMON selftests in a QEMU VM without KVM, on mm-new and
on mm-new with this series. On mm-new, 12 tests pass, 2 fail
(sysfs_update_schemes_tried_regions_wss_estimation.py and
damos_tried_regions.py), and 1 is skipped (sysfs_memcg_path_leak.sh,
because kmemleak is not available). With this series, 13 pass, 1 fails
(the wss_estimation one), and the same one is skipped, so I saw no
failure that mm-new does not also have.
None of the selftests read the new stat, so I also checked it on a
live kernel. In the same kind of VM running this series, I started two
Docker containers, each running a Python process that allocates 512 MiB
and 2 GiB of anonymous memory and then holds it. Each process was
monitored by its own kdamond, using the vaddr operations set and a
stat scheme with an anon operations layer filter, with refresh_ms set
to 1000. Output from sz_ops_filter_passed_last was correct:
# cd /sys/kernel/mm/damon/admin/kdamonds
# cat 0/contexts/0/schemes/0/stats/sz_ops_filter_passed_last
546385920
# cat 1/contexts/0/schemes/0/stats/sz_ops_filter_passed_last
2157043712
Tool use
========
Claude (Anthropic) assisted with the code, kunit test, documents, and
changelogs of this series, as noted by the Assisted-by: tags. I
reviewed all of it and ran the tests listed above.
Changes from v2
- v2: https://lore.kernel.org/20261117-damon-sz-ops-b4-v2-0-439888fa04ac@uber.com
- Collect R-b: from SJ.
Changes in v2:
- Patch 2: join the attribute declaration onto one line
- Patch 3: call damos_set_filters_default_reject() before adding the
scheme
- Patch 4: keep only the stats list bullet, dropping the explanation
that the stat is not accumulated
- Patch 5: wrap the stats line in the usage document
- Link to v1: https://patch.msgid.link/20261116-damon-sz-ops-b4-v1-0-1cffe7227e6d@uber.com
Mattathias Pinchover (6):
mm/damon/core: introduce sz_ops_filter_passed_last stat
mm/damon/sysfs-schemes: add sz_ops_filter_passed_last file
mm/damon/tests/core-kunit: test sz_ops_filter_passed_last
Docs/mm/damon/design: update for sz_ops_filter_passed_last
Docs/admin-guide/mm/damon/usage: update for sz_ops_filter_passed_last
Docs/ABI/damon: update for sz_ops_filter_passed_last
.../ABI/testing/sysfs-kernel-mm-damon | 7 ++
Documentation/admin-guide/mm/damon/usage.rst | 9 +-
Documentation/mm/damon/design.rst | 2 +
include/linux/damon.h | 6 ++
mm/damon/core.c | 5 +
mm/damon/sysfs-schemes.c | 16 ++++
mm/damon/tests/core-kunit.h | 93 +++++++++++++++++++
7 files changed, 135 insertions(+), 3 deletions(-)
base-commit: 60a393b8ae5d63691c0ea9b21571441911afd81a
--
2.47.3
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH v3 4/6] Docs/mm/damon/design: update for sz_ops_filter_passed_last
2026-11-23 15:13 [PATCH v3 0/6] mm/damon: add sz_ops_filter_passed_last DAMOS stat SJ Park
@ 2026-11-23 15:13 ` SJ Park
2026-11-23 15:13 ` [PATCH v3 5/6] Docs/admin-guide/mm/damon/usage: " SJ Park
1 sibling, 0 replies; 3+ messages in thread
From: SJ Park @ 2026-11-23 15:13 UTC (permalink / raw)
To: Andrew Morton
Cc: Mattathias Pinchover, Jonathan Corbet, Randy Dunlap, SJ Park,
Shuah Khan, damon, linux-doc, linux-mm
From: Mattathias Pinchover <mattathias.pinchover@uber.com>
Update DAMON design document for the newly added DAMOS stat,
sz_ops_filter_passed_last.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Mattathias Pinchover <mattathias.pinchover@uber.com>
Reviewed-by: SJ Park <sj@kernel.org>
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 6284b90054430..ca8fbf93d556f 100644
--- a/Documentation/mm/damon/design.rst
+++ b/Documentation/mm/damon/design.rst
@@ -876,6 +876,8 @@ scheme's execution.
- ``sz_tried``: Total size of regions that the scheme is tried to be applied.
- ``sz_ops_filter_passed``: Total bytes that passed operations set
layer-handled DAMOS filters.
+- ``sz_ops_filter_passed_last``: Bytes that passed operations set
+ layer-handled DAMOS filters in the last ``apply_interval``.
- ``nr_applied``: Total number of regions that the scheme is applied.
- ``sz_applied``: Total size of regions that the scheme is applied.
- ``qt_exceeds``: Total number of times the quota of the scheme has exceeded.
--
2.47.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH v3 5/6] Docs/admin-guide/mm/damon/usage: update for sz_ops_filter_passed_last
2026-11-23 15:13 [PATCH v3 0/6] mm/damon: add sz_ops_filter_passed_last DAMOS stat SJ Park
2026-11-23 15:13 ` [PATCH v3 4/6] Docs/mm/damon/design: update for sz_ops_filter_passed_last SJ Park
@ 2026-11-23 15:13 ` SJ Park
1 sibling, 0 replies; 3+ messages in thread
From: SJ Park @ 2026-11-23 15:13 UTC (permalink / raw)
To: Andrew Morton
Cc: Mattathias Pinchover, Jonathan Corbet, Randy Dunlap, SJ Park,
Shuah Khan, damon, linux-doc, linux-mm
From: Mattathias Pinchover <mattathias.pinchover@uber.com>
Update DAMON usage document for the newly added DAMOS stat file,
sz_ops_filter_passed_last.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Mattathias Pinchover <mattathias.pinchover@uber.com>
Reviewed-by: SJ Park <sj@kernel.org>
Signed-off-by: SJ Park <sj@kernel.org>
---
Documentation/admin-guide/mm/damon/usage.rst | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/Documentation/admin-guide/mm/damon/usage.rst b/Documentation/admin-guide/mm/damon/usage.rst
index 6093b1c8fbfd9..51c4909f1a8b2 100644
--- a/Documentation/admin-guide/mm/damon/usage.rst
+++ b/Documentation/admin-guide/mm/damon/usage.rst
@@ -105,7 +105,10 @@ comma (",").
│ │ │ │ │ │ │ │ 0/type,matching,allow,memcg_path,addr_start,addr_end,damon_target_idx,min,max
│ │ │ │ │ │ │ :ref:`dests <damon_sysfs_dests>`/nr_dests
│ │ │ │ │ │ │ │ 0/id,weight
- │ │ │ │ │ │ │ :ref:`stats <sysfs_schemes_stats>`/nr_tried,sz_tried,nr_applied,sz_applied,sz_ops_filter_passed,qt_exceeds,nr_snapshots,max_nr_snapshots
+ │ │ │ │ │ │ │ :ref:`stats <sysfs_schemes_stats>`/nr_tried,sz_tried,
+ │ │ │ │ │ │ │ nr_applied,sz_applied,sz_ops_filter_passed,
+ │ │ │ │ │ │ │ sz_ops_filter_passed_last,qt_exceeds,nr_snapshots,
+ │ │ │ │ │ │ │ max_nr_snapshots
│ │ │ │ │ │ │ :ref:`tried_regions <sysfs_schemes_tried_regions>`/total_bytes
│ │ │ │ │ │ │ │ 0/start,end,nr_accesses,age,sz_filter_passed
│ │ │ │ │ │ │ │ │ probes
@@ -631,8 +634,8 @@ online analysis or tuning of the schemes. Refer to :ref:`design doc
The statistics can be retrieved by reading the files under ``stats`` directory
(``nr_tried``, ``sz_tried``, ``nr_applied``, ``sz_applied``,
-``sz_ops_filter_passed``, ``qt_exceeds``, ``nr_snapshots`` and
-``max_nr_snapshots``), respectively.
+``sz_ops_filter_passed``, ``sz_ops_filter_passed_last``,
+``qt_exceeds``, ``nr_snapshots`` and ``max_nr_snapshots``), respectively.
The files are not updated in real time by default. Users should ask DAMON
sysfs interface to periodically update those using ``refresh_ms``, or do a one
--
2.47.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-23 15:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-23 15:13 [PATCH v3 0/6] mm/damon: add sz_ops_filter_passed_last DAMOS stat SJ Park
2026-11-23 15:13 ` [PATCH v3 4/6] Docs/mm/damon/design: update for sz_ops_filter_passed_last SJ Park
2026-11-23 15:13 ` [PATCH v3 5/6] Docs/admin-guide/mm/damon/usage: " SJ Park
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox