Skip to contentSkip to conversation

mm/damon: add sz_ops_filter_passed_last DAMOS stat

PATCH New SJ Park 3 participants 14 messages Nov 23

Subsystems (5)
lore
Share & tools
lore

SJ Park

author maintainer
#0 lore raw

v3 cover mm/damon: add sz_ops_filter_passed_last DAMOS stat

From: Mattathias Pinchover <[email protected]>

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/[email protected]
- 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/[email protected]

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

Signature · 1 line
2.47.3
author maintainer
#1 lore raw

PATCH v3 1/6 mm/damon/core: introduce sz_ops_filter_passed_last stat

From: Mattathias Pinchover <[email protected]>

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, need to keep the previous values in user space and compute the difference with the help of nr_snapshots. Because nr_snapshots is increased once per target per apply interval, the computation is complicated and error-prone, especially for contexts having multiple targets.

Introduce a new DAMOS stat, sz_ops_filter_passed_last. It is updated at the end of each apply interval of the scheme with the amount of sz_ops_filter_passed increase in the interval.

Assisted-by Claude:claude-opus-5-5
---
 include/linux/damon.h | 6 ++++++
 mm/damon/core.c       | 5 +++++
 2 files changed, 11 insertions(+)
include/linux/damon.h +6 -0
index 06bd92981af21..3aff5c525132b 100644
@@ -351,6 +351,9 @@ struct damos_watermarks {
  * @sz_applied:	Total size of regions that the scheme is applied.
  * @sz_ops_filter_passed:
  *		Total bytes that passed ops layer-handled DAMOS filters.
+ * @sz_ops_filter_passed_last:
+ *		Bytes that passed ops layer-handled DAMOS filters in the last
+ *		apply interval.
  * @qt_exceeds: Total number of times the quota of the scheme has exceeded.
  * @nr_snapshots:
  *		Total number of DAMON snapshots that the scheme is completely
@@ -379,6 +382,7 @@ struct damos_stat {
 	unsigned long nr_applied;
 	unsigned long sz_applied;
 	unsigned long sz_ops_filter_passed;
+	unsigned long sz_ops_filter_passed_last;
 	unsigned long qt_exceeds;
 	unsigned long nr_snapshots;
 };
@@ -578,6 +582,8 @@ struct damos {
 	 * @action
 	 */
 	unsigned long next_apply_sis;
+	/* @stat.sz_ops_filter_passed at the start of the current apply interval */
+	unsigned long sz_ops_filter_passed_at_start;
 	/* informs if ongoing DAMOS walk for this scheme is finished */
 	bool walk_completed;
 	/*
mm/damon/core.c +5 -0
index 986404b547ebd..a99663f1f7ef0 100644
@@ -769,6 +769,7 @@ struct damos *damon_new_scheme(struct damos_access_pattern *pattern,
 	 * or damon_attrs are updated.
 	 */
 	scheme->next_apply_sis = 0;
+	scheme->sz_ops_filter_passed_at_start = 0;
 	scheme->walk_completed = false;
 	INIT_LIST_HEAD(&scheme->core_filters);
 	INIT_LIST_HEAD(&scheme->ops_filters);
@@ -3532,6 +3533,10 @@ static noinline_for_stack void kdamond_apply_schemes(struct damon_ctx *c)
 		if (time_before(c->passed_sample_intervals, s->next_apply_sis))
 			continue;
 		damos_walk_complete(c, s);
+		s->stat.sz_ops_filter_passed_last =
+			s->stat.sz_ops_filter_passed -
+			s->sz_ops_filter_passed_at_start;
+		s->sz_ops_filter_passed_at_start = s->stat.sz_ops_filter_passed;
 		damos_set_next_apply_sis(s, c);
 		s->last_applied = NULL;
 		damos_trace_stat(c, s);
Signature · 1 line
2.47.3
author maintainer
#3 lore raw

PATCH v3 2/6 mm/damon/sysfs-schemes: add sz_ops_filter_passed_last file

In reply to SJ Park

From: Mattathias Pinchover <[email protected]>

Introduce a new DAMON sysfs interface file for exposing the newly added DAMOS stat, sz_ops_filter_passed_last. The file has the same name as the stat and is placed under the DAMOS stats directory. Like other stats files, it is updated when the stats are refreshed via refresh_ms or the update_schemes_stats command.

Assisted-by Claude:claude-opus-5-5
---
 mm/damon/sysfs-schemes.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
mm/damon/sysfs-schemes.c +16 -0
index 230987efac3ac..750f70f0c31be 100644
@@ -370,6 +370,7 @@ struct damon_sysfs_stats {
 	unsigned long nr_applied;
 	unsigned long sz_applied;
 	unsigned long sz_ops_filter_passed;
+	unsigned long sz_ops_filter_passed_last;
 	unsigned long qt_exceeds;
 	unsigned long nr_snapshots;
 	unsigned long max_nr_snapshots;
@@ -425,6 +426,15 @@ static ssize_t sz_ops_filter_passed_show(struct kobject *kobj,
 	return sysfs_emit(buf, "%lu\n", stats->sz_ops_filter_passed);
 }
 
+static ssize_t sz_ops_filter_passed_last_show(struct kobject *kobj,
+		struct kobj_attribute *attr, char *buf)
+{
+	struct damon_sysfs_stats *stats = container_of(kobj,
+			struct damon_sysfs_stats, kobj);
+
+	return sysfs_emit(buf, "%lu\n", stats->sz_ops_filter_passed_last);
+}
+
 static ssize_t qt_exceeds_show(struct kobject *kobj,
 		struct kobj_attribute *attr, char *buf)
 {
@@ -485,6 +495,9 @@ static struct kobj_attribute damon_sysfs_stats_sz_applied_attr =
 static struct kobj_attribute damon_sysfs_stats_sz_ops_filter_passed_attr =
 		__ATTR_RO_MODE(sz_ops_filter_passed, 0400);
 
+static struct kobj_attribute damon_sysfs_stats_sz_ops_filter_passed_last_attr =
+		__ATTR_RO_MODE(sz_ops_filter_passed_last, 0400);
+
 static struct kobj_attribute damon_sysfs_stats_qt_exceeds_attr =
 		__ATTR_RO_MODE(qt_exceeds, 0400);
 
@@ -500,6 +513,7 @@ static struct attribute *damon_sysfs_stats_attrs[] = {
 	&damon_sysfs_stats_nr_applied_attr.attr,
 	&damon_sysfs_stats_sz_applied_attr.attr,
 	&damon_sysfs_stats_sz_ops_filter_passed_attr.attr,
+	&damon_sysfs_stats_sz_ops_filter_passed_last_attr.attr,
 	&damon_sysfs_stats_qt_exceeds_attr.attr,
 	&damon_sysfs_stats_nr_snapshots_attr.attr,
 	&damon_sysfs_stats_max_nr_snapshots_attr.attr,
@@ -3130,6 +3144,8 @@ void damon_sysfs_schemes_update_stats(
 		sysfs_stats->sz_applied = scheme->stat.sz_applied;
 		sysfs_stats->sz_ops_filter_passed =
 			scheme->stat.sz_ops_filter_passed;
+		sysfs_stats->sz_ops_filter_passed_last =
+			scheme->stat.sz_ops_filter_passed_last;
 		sysfs_stats->qt_exceeds = scheme->stat.qt_exceeds;
 		sysfs_stats->nr_snapshots = scheme->stat.nr_snapshots;
 	}
Signature · 1 line
2.47.3
author maintainer
#5 lore raw

PATCH v3 3/6 mm/damon/tests/core-kunit: test sz_ops_filter_passed_last

In reply to SJ Park

From: Mattathias Pinchover <[email protected]>

Add a kunit test for the sz_ops_filter_passed_last DAMOS stat. The test runs kdamond_apply_schemes() for multiple apply intervals with a stub apply_scheme() operation that reports a given ops filter-passed size, and checks that the stat is set to the value of the last apply interval rather than the accumulated value, and that it is kept unchanged until the next apply interval is completed.

Assisted-by Claude:claude-opus-5-5
---
 mm/damon/tests/core-kunit.h | 93 +++++++++++++++++++++++++++++++++++++
 1 file changed, 93 insertions(+)
mm/damon/tests/core-kunit.h +93 -0
index a5ca4bfe2f0db..d256e6b7de73a 100644
@@ -2541,6 +2541,98 @@ static void damon_test_last_region_quota_reset(struct kunit *test)
 	damon_destroy_ctx(ctx);
 }
 
+/* bytes that damos_test_apply_scheme_passed_stub() reports per region */
+static unsigned long damos_test_sz_passed;
+
+static unsigned long damos_test_apply_scheme_passed_stub(struct damon_ctx *c,
+		struct damon_target *t, struct damon_region *r,
+		struct damos *s, unsigned long *sz_filter_passed)
+{
+	*sz_filter_passed = damos_test_sz_passed;
+	return 0;
+}
+
+/* run one apply interval and return the last apply interval's passed bytes */
+static unsigned long damos_test_apply_interval(struct damon_ctx *c,
+		struct damos *s)
+{
+	c->passed_sample_intervals = s->next_apply_sis;
+	kdamond_apply_schemes(c);
+	return s->stat.sz_ops_filter_passed_last;
+}
+
+static void damos_test_sz_ops_filter_passed_last(struct kunit *test)
+{
+	struct damos_access_pattern pattern = {
+		.min_sz_region = 0,
+		.max_sz_region = ULONG_MAX,
+		.min_nr_accesses = 0,
+		.max_nr_accesses = UINT_MAX,
+		.min_age_region = 0,
+		.max_age_region = UINT_MAX,
+	};
+	struct damos_watermarks wmarks = {};
+	struct damos_quota quota = {};
+	struct damon_ctx *c;
+	struct damon_target *t;
+	struct damon_region *r;
+	struct damos *s;
+
+	c = damon_new_ctx();
+	if (!c)
+		kunit_skip(test, "ctx alloc fail");
+	c->ops.apply_scheme = damos_test_apply_scheme_passed_stub;
+
+	s = damon_new_scheme(&pattern, DAMOS_STAT, 0, &quota, &wmarks,
+			NUMA_NO_NODE);
+	if (!s) {
+		damon_destroy_ctx(c);
+		kunit_skip(test, "scheme alloc fail");
+	}
+	damos_set_filters_default_reject(s);
+	damon_add_scheme(c, s);
+
+	t = damon_new_target();
+	if (!t) {
+		damon_destroy_ctx(c);
+		kunit_skip(test, "target alloc fail");
+	}
+	damon_add_target(c, t);
+
+	r = damon_new_region(0, DAMON_MIN_REGION_SZ);
+	if (!r) {
+		damon_destroy_ctx(c);
+		kunit_skip(test, "region alloc fail");
+	}
+	damon_add_region(r, t);
+
+	KUNIT_EXPECT_EQ(test, s->stat.sz_ops_filter_passed_last, 0);
+
+	/* each value is for the last apply interval only, not cumulative */
+	damos_test_sz_passed = 1000;
+	KUNIT_EXPECT_EQ(test, damos_test_apply_interval(c, s), 1000);
+	KUNIT_EXPECT_EQ(test, damos_test_apply_interval(c, s), 1000);
+	KUNIT_EXPECT_EQ(test, s->stat.sz_ops_filter_passed, 2000);
+
+	damos_test_sz_passed = 300;
+	KUNIT_EXPECT_EQ(test, damos_test_apply_interval(c, s), 300);
+	KUNIT_EXPECT_EQ(test, s->stat.sz_ops_filter_passed, 2300);
+
+	damos_test_sz_passed = 0;
+	KUNIT_EXPECT_EQ(test, damos_test_apply_interval(c, s), 0);
+	KUNIT_EXPECT_EQ(test, s->stat.sz_ops_filter_passed, 2300);
+
+	/* not yet the time to apply, so the last value should be kept */
+	damos_test_sz_passed = 500;
+	damos_test_apply_interval(c, s);
+	c->passed_sample_intervals = s->next_apply_sis - 1;
+	kdamond_apply_schemes(c);
+	KUNIT_EXPECT_EQ(test, s->stat.sz_ops_filter_passed_last,
+			500);
+
+	damon_destroy_ctx(c);
+}
+
 static struct kunit_case damon_test_cases[] = {
 	KUNIT_CASE(damon_test_target),
 	KUNIT_CASE(damon_test_regions),
@@ -2585,6 +2677,7 @@ static struct kunit_case damon_test_cases[] = {
 	KUNIT_CASE(damon_test_rand),
 	KUNIT_CASE(damos_test_esz_goal_temporal),
 	KUNIT_CASE(damon_test_last_region_quota_reset),
+	KUNIT_CASE(damos_test_sz_ops_filter_passed_last),
 	{},
 };
 
Signature · 1 line
2.47.3
author maintainer
#7 lore raw

PATCH v3 4/6 Docs/mm/damon/design: update for sz_ops_filter_passed_last

In reply to SJ Park

From: Mattathias Pinchover <[email protected]>

Update DAMON design document for the newly added DAMOS stat, sz_ops_filter_passed_last.

Assisted-by Claude:claude-opus-5-5
---
 Documentation/mm/damon/design.rst | 2 ++
 1 file changed, 2 insertions(+)
Documentation/mm/damon/design.rst +2 -0
index 6284b90054430..ca8fbf93d556f 100644
@@ -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.
Signature · 1 line
2.47.3
author maintainer
#9 lore raw

PATCH v3 5/6 Docs/admin-guide/mm/damon/usage: update for sz_ops_filter_passed_last

In reply to SJ Park

From: Mattathias Pinchover <[email protected]>

Update DAMON usage document for the newly added DAMOS stat file, sz_ops_filter_passed_last.

Assisted-by Claude:claude-opus-5-5
---
 Documentation/admin-guide/mm/damon/usage.rst | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
Documentation/admin-guide/mm/damon/usage.rst +6 -3
index 6093b1c8fbfd9..51c4909f1a8b2 100644
@@ -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
Signature · 1 line
2.47.3
author maintainer
#11 lore raw

PATCH v3 6/6 Docs/ABI/damon: update for sz_ops_filter_passed_last

In reply to SJ Park

From: Mattathias Pinchover <[email protected]>

Update DAMON ABI document for the newly added DAMOS stat file, sz_ops_filter_passed_last.

Assisted-by Claude:claude-opus-5-5
---
 Documentation/ABI/testing/sysfs-kernel-mm-damon | 7 +++++++
 1 file changed, 7 insertions(+)
Documentation/ABI/testing/sysfs-kernel-mm-damon +7 -0
index 4acb2015c2f4f..92348178e48a0 100644
@@ -623,6 +623,13 @@ Contact:	SJ Park <[email protected]>
 Description:	Reading this file returns the total size of memory that passed
 		DAMON operations layer-handled filters of the scheme in bytes.
 
+What:		/sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/stats/sz_ops_filter_passed_last
+Date:		Nov 2026
+Contact:	SJ Park <[email protected]>
+Description:	Reading this file returns the size of memory that passed DAMON
+		operations layer-handled filters of the scheme in bytes, in the
+		last apply interval of the scheme.
+
 What:		/sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/stats/qt_exceeds
 Date:		Mar 2022
 Contact:	SJ Park <[email protected]>
Signature · 1 line
2.47.3
maintainer tree notice
#2 lore raw

+ mm-damon-core-introduce-sz_ops_filter_passed_last-stat.patch added to mm-new branch

In reply to SJ Park
The patch titled Subject: mm/damon/core: introduce sz_ops_filter_passed_last stat has been added to the -mm mm-new branch. Its filename is mm-damon-core-introduce-sz_ops_filter_passed_last-stat.patch

The patch titled
Subject: mm/damon/core: introduce sz_ops_filter_passed_last stat
has been added to the -mm mm-new branch. Its filename is
mm-damon-core-introduce-sz_ops_filter_passed_last-stat.patch

This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-damon-core-introduce-sz_ops_filter_passed_last-stat.patch

This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Note, mm-new is a provisional staging ground for work-in-progress patches, and acceptance into mm-new is a notification for others take notice and to finish up reviews. Please do not hesitate to respond to review feedback and post updated versions to replace or incrementally fixup patches in mm-new.

The mm-new branch of mm.git is not included in linux-next

If a few days of testing in mm-new is successful, the patch will me moved into mm.git's mm-unstable branch, which is included in linux-next

Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next via various branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days

------------------------------------------------------
From: Mattathias Pinchover <[email protected]>
Subject: mm/damon/core: introduce sz_ops_filter_passed_last stat
Date: Mon, 23 Nov 2026 07:13:02 -0800

Patch series "mm/damon: add sz_ops_filter_passed_last DAMOS stat", v3.

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. I reviewed all of it and ran the tests listed above.

This patch (of 6):

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, need to keep the previous values in user space and compute the difference with the help of nr_snapshots. Because nr_snapshots is increased once per target per apply interval, the computation is complicated and error-prone, especially for contexts having multiple targets.

Introduce a new DAMOS stat, sz_ops_filter_passed_last. It is updated at the end of each apply interval of the scheme with the amount of sz_ops_filter_passed increase in the interval.

 include/linux/damon.h |    6 ++++++
 mm/damon/core.c       |    5 +++++
 2 files changed, 11 insertions(+)
include/linux/damon.h renamed from include/linux/damon.h~mm-damon-core-introduce-sz_ops_filter_passed_last-stat +6 -0
@@ -351,6 +351,9 @@ struct damos_watermarks {
  * @sz_applied:	Total size of regions that the scheme is applied.
  * @sz_ops_filter_passed:
  *		Total bytes that passed ops layer-handled DAMOS filters.
+ * @sz_ops_filter_passed_last:
+ *		Bytes that passed ops layer-handled DAMOS filters in the last
+ *		apply interval.
  * @qt_exceeds: Total number of times the quota of the scheme has exceeded.
  * @nr_snapshots:
  *		Total number of DAMON snapshots that the scheme is completely
@@ -379,6 +382,7 @@ struct damos_stat {
 	unsigned long nr_applied;
 	unsigned long sz_applied;
 	unsigned long sz_ops_filter_passed;
+	unsigned long sz_ops_filter_passed_last;
 	unsigned long qt_exceeds;
 	unsigned long nr_snapshots;
 };
@@ -578,6 +582,8 @@ struct damos {
 	 * @action
 	 */
 	unsigned long next_apply_sis;
+	/* @stat.sz_ops_filter_passed at the start of the current apply interval */
+	unsigned long sz_ops_filter_passed_at_start;
 	/* informs if ongoing DAMOS walk for this scheme is finished */
 	bool walk_completed;
 	/*
mm/damon/core.c renamed from mm/damon/core.c~mm-damon-core-introduce-sz_ops_filter_passed_last-stat +5 -0
@@ -769,6 +769,7 @@ struct damos *damon_new_scheme(struct da
 	 * or damon_attrs are updated.
 	 */
 	scheme->next_apply_sis = 0;
+	scheme->sz_ops_filter_passed_at_start = 0;
 	scheme->walk_completed = false;
 	INIT_LIST_HEAD(&scheme->core_filters);
 	INIT_LIST_HEAD(&scheme->ops_filters);
@@ -3532,6 +3533,10 @@ static noinline_for_stack void kdamond_a
 		if (time_before(c->passed_sample_intervals, s->next_apply_sis))
 			continue;
 		damos_walk_complete(c, s);
+		s->stat.sz_ops_filter_passed_last =
+			s->stat.sz_ops_filter_passed -
+			s->sz_ops_filter_passed_at_start;
+		s->sz_ops_filter_passed_at_start = s->stat.sz_ops_filter_passed;
 		damos_set_next_apply_sis(s, c);
 		s->last_applied = NULL;
 		damos_trace_stat(c, s);

_

Patches currently in -mm which might be from [email protected] are

mm-damon-core-introduce-sz_ops_filter_passed_last-stat.patch mm-damon-sysfs-schemes-add-sz_ops_filter_passed_last-file.patch mm-damon-tests-core-kunit-test-sz_ops_filter_passed_last.patch docs-mm-damon-design-update-for-sz_ops_filter_passed_last.patch docs-admin-guide-mm-damon-usage-update-for-sz_ops_filter_passed_last.patch docs-abi-damon-update-for-sz_ops_filter_passed_last.patch

maintainer tree notice
#4 lore raw

+ mm-damon-sysfs-schemes-add-sz_ops_filter_passed_last-file.patch added to mm-new branch

In reply to SJ Park
The patch titled Subject: mm/damon/sysfs-schemes: add sz_ops_filter_passed_last file has been added to the -mm mm-new branch. Its filename is…

The patch titled
Subject: mm/damon/sysfs-schemes: add sz_ops_filter_passed_last file
has been added to the -mm mm-new branch. Its filename is
mm-damon-sysfs-schemes-add-sz_ops_filter_passed_last-file.patch

This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-damon-sysfs-schemes-add-sz_ops_filter_passed_last-file.patch

This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Note, mm-new is a provisional staging ground for work-in-progress patches, and acceptance into mm-new is a notification for others take notice and to finish up reviews. Please do not hesitate to respond to review feedback and post updated versions to replace or incrementally fixup patches in mm-new.

The mm-new branch of mm.git is not included in linux-next

If a few days of testing in mm-new is successful, the patch will me moved into mm.git's mm-unstable branch, which is included in linux-next

Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next via various branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days

------------------------------------------------------
From: Mattathias Pinchover <[email protected]>
Subject: mm/damon/sysfs-schemes: add sz_ops_filter_passed_last file
Date: Mon, 23 Nov 2026 07:13:03 -0800

Introduce a new DAMON sysfs interface file for exposing the newly added DAMOS stat, sz_ops_filter_passed_last. The file has the same name as the stat and is placed under the DAMOS stats directory. Like other stats files, it is updated when the stats are refreshed via refresh_ms or the update_schemes_stats command.

 mm/damon/sysfs-schemes.c |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)
mm/damon/sysfs-schemes.c renamed from mm/damon/sysfs-schemes.c~mm-damon-sysfs-schemes-add-sz_ops_filter_passed_last-file +16 -0
@@ -370,6 +370,7 @@ struct damon_sysfs_stats {
 	unsigned long nr_applied;
 	unsigned long sz_applied;
 	unsigned long sz_ops_filter_passed;
+	unsigned long sz_ops_filter_passed_last;
 	unsigned long qt_exceeds;
 	unsigned long nr_snapshots;
 	unsigned long max_nr_snapshots;
@@ -425,6 +426,15 @@ static ssize_t sz_ops_filter_passed_show
 	return sysfs_emit(buf, "%lu\n", stats->sz_ops_filter_passed);
 }
 
+static ssize_t sz_ops_filter_passed_last_show(struct kobject *kobj,
+		struct kobj_attribute *attr, char *buf)
+{
+	struct damon_sysfs_stats *stats = container_of(kobj,
+			struct damon_sysfs_stats, kobj);
+
+	return sysfs_emit(buf, "%lu\n", stats->sz_ops_filter_passed_last);
+}
+
 static ssize_t qt_exceeds_show(struct kobject *kobj,
 		struct kobj_attribute *attr, char *buf)
 {
@@ -485,6 +495,9 @@ static struct kobj_attribute damon_sysfs
 static struct kobj_attribute damon_sysfs_stats_sz_ops_filter_passed_attr =
 		__ATTR_RO_MODE(sz_ops_filter_passed, 0400);
 
+static struct kobj_attribute damon_sysfs_stats_sz_ops_filter_passed_last_attr =
+		__ATTR_RO_MODE(sz_ops_filter_passed_last, 0400);
+
 static struct kobj_attribute damon_sysfs_stats_qt_exceeds_attr =
 		__ATTR_RO_MODE(qt_exceeds, 0400);
 
@@ -500,6 +513,7 @@ static struct attribute *damon_sysfs_sta
 	&damon_sysfs_stats_nr_applied_attr.attr,
 	&damon_sysfs_stats_sz_applied_attr.attr,
 	&damon_sysfs_stats_sz_ops_filter_passed_attr.attr,
+	&damon_sysfs_stats_sz_ops_filter_passed_last_attr.attr,
 	&damon_sysfs_stats_qt_exceeds_attr.attr,
 	&damon_sysfs_stats_nr_snapshots_attr.attr,
 	&damon_sysfs_stats_max_nr_snapshots_attr.attr,
@@ -3130,6 +3144,8 @@ void damon_sysfs_schemes_update_stats(
 		sysfs_stats->sz_applied = scheme->stat.sz_applied;
 		sysfs_stats->sz_ops_filter_passed =
 			scheme->stat.sz_ops_filter_passed;
+		sysfs_stats->sz_ops_filter_passed_last =
+			scheme->stat.sz_ops_filter_passed_last;
 		sysfs_stats->qt_exceeds = scheme->stat.qt_exceeds;
 		sysfs_stats->nr_snapshots = scheme->stat.nr_snapshots;
 	}

_

Patches currently in -mm which might be from [email protected] are

mm-damon-core-introduce-sz_ops_filter_passed_last-stat.patch mm-damon-sysfs-schemes-add-sz_ops_filter_passed_last-file.patch mm-damon-tests-core-kunit-test-sz_ops_filter_passed_last.patch docs-mm-damon-design-update-for-sz_ops_filter_passed_last.patch docs-admin-guide-mm-damon-usage-update-for-sz_ops_filter_passed_last.patch docs-abi-damon-update-for-sz_ops_filter_passed_last.patch

maintainer tree notice
#6 lore raw

+ mm-damon-tests-core-kunit-test-sz_ops_filter_passed_last.patch added to mm-new branch

In reply to SJ Park
The patch titled Subject: mm/damon/tests/core-kunit: test sz_ops_filter_passed_last has been added to the -mm mm-new branch. Its filename is…

The patch titled
Subject: mm/damon/tests/core-kunit: test sz_ops_filter_passed_last
has been added to the -mm mm-new branch. Its filename is
mm-damon-tests-core-kunit-test-sz_ops_filter_passed_last.patch

This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-damon-tests-core-kunit-test-sz_ops_filter_passed_last.patch

This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Note, mm-new is a provisional staging ground for work-in-progress patches, and acceptance into mm-new is a notification for others take notice and to finish up reviews. Please do not hesitate to respond to review feedback and post updated versions to replace or incrementally fixup patches in mm-new.

The mm-new branch of mm.git is not included in linux-next

If a few days of testing in mm-new is successful, the patch will me moved into mm.git's mm-unstable branch, which is included in linux-next

Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next via various branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days

------------------------------------------------------
From: Mattathias Pinchover <[email protected]>
Subject: mm/damon/tests/core-kunit: test sz_ops_filter_passed_last
Date: Mon, 23 Nov 2026 07:13:04 -0800

Add a kunit test for the sz_ops_filter_passed_last DAMOS stat. The test runs kdamond_apply_schemes() for multiple apply intervals with a stub apply_scheme() operation that reports a given ops filter-passed size, and checks that the stat is set to the value of the last apply interval rather than the accumulated value, and that it is kept unchanged until the next apply interval is completed.

 mm/damon/tests/core-kunit.h |   93 ++++++++++++++++++++++++++++++++++
 1 file changed, 93 insertions(+)
mm/damon/tests/core-kunit.h renamed from mm/damon/tests/core-kunit.h~mm-damon-tests-core-kunit-test-sz_ops_filter_passed_last +93 -0
@@ -2632,6 +2632,98 @@ static void damon_test_last_region_quota
 	damon_destroy_ctx(ctx);
 }
 
+/* bytes that damos_test_apply_scheme_passed_stub() reports per region */
+static unsigned long damos_test_sz_passed;
+
+static unsigned long damos_test_apply_scheme_passed_stub(struct damon_ctx *c,
+		struct damon_target *t, struct damon_region *r,
+		struct damos *s, unsigned long *sz_filter_passed)
+{
+	*sz_filter_passed = damos_test_sz_passed;
+	return 0;
+}
+
+/* run one apply interval and return the last apply interval's passed bytes */
+static unsigned long damos_test_apply_interval(struct damon_ctx *c,
+		struct damos *s)
+{
+	c->passed_sample_intervals = s->next_apply_sis;
+	kdamond_apply_schemes(c);
+	return s->stat.sz_ops_filter_passed_last;
+}
+
+static void damos_test_sz_ops_filter_passed_last(struct kunit *test)
+{
+	struct damos_access_pattern pattern = {
+		.min_sz_region = 0,
+		.max_sz_region = ULONG_MAX,
+		.min_nr_accesses = 0,
+		.max_nr_accesses = UINT_MAX,
+		.min_age_region = 0,
+		.max_age_region = UINT_MAX,
+	};
+	struct damos_watermarks wmarks = {};
+	struct damos_quota quota = {};
+	struct damon_ctx *c;
+	struct damon_target *t;
+	struct damon_region *r;
+	struct damos *s;
+
+	c = damon_new_ctx();
+	if (!c)
+		kunit_skip(test, "ctx alloc fail");
+	c->ops.apply_scheme = damos_test_apply_scheme_passed_stub;
+
+	s = damon_new_scheme(&pattern, DAMOS_STAT, 0, &quota, &wmarks,
+			NUMA_NO_NODE);
+	if (!s) {
+		damon_destroy_ctx(c);
+		kunit_skip(test, "scheme alloc fail");
+	}
+	damos_set_filters_default_reject(s);
+	damon_add_scheme(c, s);
+
+	t = damon_new_target();
+	if (!t) {
+		damon_destroy_ctx(c);
+		kunit_skip(test, "target alloc fail");
+	}
+	damon_add_target(c, t);
+
+	r = damon_new_region(0, DAMON_MIN_REGION_SZ);
+	if (!r) {
+		damon_destroy_ctx(c);
+		kunit_skip(test, "region alloc fail");
+	}
+	damon_add_region(r, t);
+
+	KUNIT_EXPECT_EQ(test, s->stat.sz_ops_filter_passed_last, 0);
+
+	/* each value is for the last apply interval only, not cumulative */
+	damos_test_sz_passed = 1000;
+	KUNIT_EXPECT_EQ(test, damos_test_apply_interval(c, s), 1000);
+	KUNIT_EXPECT_EQ(test, damos_test_apply_interval(c, s), 1000);
+	KUNIT_EXPECT_EQ(test, s->stat.sz_ops_filter_passed, 2000);
+
+	damos_test_sz_passed = 300;
+	KUNIT_EXPECT_EQ(test, damos_test_apply_interval(c, s), 300);
+	KUNIT_EXPECT_EQ(test, s->stat.sz_ops_filter_passed, 2300);
+
+	damos_test_sz_passed = 0;
+	KUNIT_EXPECT_EQ(test, damos_test_apply_interval(c, s), 0);
+	KUNIT_EXPECT_EQ(test, s->stat.sz_ops_filter_passed, 2300);
+
+	/* not yet the time to apply, so the last value should be kept */
+	damos_test_sz_passed = 500;
+	damos_test_apply_interval(c, s);
+	c->passed_sample_intervals = s->next_apply_sis - 1;
+	kdamond_apply_schemes(c);
+	KUNIT_EXPECT_EQ(test, s->stat.sz_ops_filter_passed_last,
+			500);
+
+	damon_destroy_ctx(c);
+}
+
 static struct kunit_case damon_test_cases[] = {
 	KUNIT_CASE(damon_test_target),
 	KUNIT_CASE(damon_test_regions),
@@ -2678,6 +2770,7 @@ static struct kunit_case damon_test_case
 	KUNIT_CASE(damon_test_rand),
 	KUNIT_CASE(damos_test_esz_goal_temporal),
 	KUNIT_CASE(damon_test_last_region_quota_reset),
+	KUNIT_CASE(damos_test_sz_ops_filter_passed_last),
 	{},
 };
 

_

Patches currently in -mm which might be from [email protected] are

mm-damon-core-introduce-sz_ops_filter_passed_last-stat.patch mm-damon-sysfs-schemes-add-sz_ops_filter_passed_last-file.patch mm-damon-tests-core-kunit-test-sz_ops_filter_passed_last.patch docs-mm-damon-design-update-for-sz_ops_filter_passed_last.patch docs-admin-guide-mm-damon-usage-update-for-sz_ops_filter_passed_last.patch docs-abi-damon-update-for-sz_ops_filter_passed_last.patch

maintainer tree notice
#8 lore raw

+ docs-mm-damon-design-update-for-sz_ops_filter_passed_last.patch added to mm-new branch

In reply to SJ Park
The patch titled Subject: Docs/mm/damon/design: update for sz_ops_filter_passed_last has been added to the -mm mm-new branch. Its filename is…

The patch titled
Subject: Docs/mm/damon/design: update for sz_ops_filter_passed_last
has been added to the -mm mm-new branch. Its filename is
docs-mm-damon-design-update-for-sz_ops_filter_passed_last.patch

This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/docs-mm-damon-design-update-for-sz_ops_filter_passed_last.patch

This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Note, mm-new is a provisional staging ground for work-in-progress patches, and acceptance into mm-new is a notification for others take notice and to finish up reviews. Please do not hesitate to respond to review feedback and post updated versions to replace or incrementally fixup patches in mm-new.

The mm-new branch of mm.git is not included in linux-next

If a few days of testing in mm-new is successful, the patch will me moved into mm.git's mm-unstable branch, which is included in linux-next

Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next via various branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days

------------------------------------------------------
From: Mattathias Pinchover <[email protected]>
Subject: Docs/mm/damon/design: update for sz_ops_filter_passed_last
Date: Mon, 23 Nov 2026 07:13:05 -0800

Update DAMON design document for the newly added DAMOS stat, sz_ops_filter_passed_last.

 Documentation/mm/damon/design.rst |    2 ++
 1 file changed, 2 insertions(+)
Documentation/mm/damon/design.rst renamed from Documentation/mm/damon/design.rst~docs-mm-damon-design-update-for-sz_ops_filter_passed_last +2 -0
@@ -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.

_

Patches currently in -mm which might be from [email protected] are

mm-damon-core-introduce-sz_ops_filter_passed_last-stat.patch mm-damon-sysfs-schemes-add-sz_ops_filter_passed_last-file.patch mm-damon-tests-core-kunit-test-sz_ops_filter_passed_last.patch docs-mm-damon-design-update-for-sz_ops_filter_passed_last.patch docs-admin-guide-mm-damon-usage-update-for-sz_ops_filter_passed_last.patch docs-abi-damon-update-for-sz_ops_filter_passed_last.patch

maintainer tree notice
#10 lore raw

+ docs-admin-guide-mm-damon-usage-update-for-sz_ops_filter_passed_last.patch added to mm-new branch

In reply to SJ Park
The patch titled Subject: Docs/admin-guide/mm/damon/usage: update for sz_ops_filter_passed_last has been added to the -mm mm-new branch. Its filename is…

The patch titled
Subject: Docs/admin-guide/mm/damon/usage: update for sz_ops_filter_passed_last
has been added to the -mm mm-new branch. Its filename is
docs-admin-guide-mm-damon-usage-update-for-sz_ops_filter_passed_last.patch

This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/docs-admin-guide-mm-damon-usage-update-for-sz_ops_filter_passed_last.patch

This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Note, mm-new is a provisional staging ground for work-in-progress patches, and acceptance into mm-new is a notification for others take notice and to finish up reviews. Please do not hesitate to respond to review feedback and post updated versions to replace or incrementally fixup patches in mm-new.

The mm-new branch of mm.git is not included in linux-next

If a few days of testing in mm-new is successful, the patch will me moved into mm.git's mm-unstable branch, which is included in linux-next

Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next via various branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days

------------------------------------------------------
From: Mattathias Pinchover <[email protected]>
Subject: Docs/admin-guide/mm/damon/usage: update for sz_ops_filter_passed_last
Date: Mon, 23 Nov 2026 07:13:06 -0800

Update DAMON usage document for the newly added DAMOS stat file, sz_ops_filter_passed_last.

 Documentation/admin-guide/mm/damon/usage.rst |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
Documentation/admin-guide/mm/damon/usage.rst renamed from Documentation/admin-guide/mm/damon/usage.rst~docs-admin-guide-mm-damon-usage-update-for-sz_ops_filter_passed_last +6 -3
@@ -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
 
 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

_

Patches currently in -mm which might be from [email protected] are

mm-damon-core-introduce-sz_ops_filter_passed_last-stat.patch mm-damon-sysfs-schemes-add-sz_ops_filter_passed_last-file.patch mm-damon-tests-core-kunit-test-sz_ops_filter_passed_last.patch docs-mm-damon-design-update-for-sz_ops_filter_passed_last.patch docs-admin-guide-mm-damon-usage-update-for-sz_ops_filter_passed_last.patch docs-abi-damon-update-for-sz_ops_filter_passed_last.patch

maintainer tree notice
#12 lore raw

+ docs-abi-damon-update-for-sz_ops_filter_passed_last.patch added to mm-new branch

In reply to SJ Park
The patch titled Subject: Docs/ABI/damon: update for sz_ops_filter_passed_last has been added to the -mm mm-new branch. Its filename is docs-abi-damon-update-for-sz_ops_filter_passed_last.patch

The patch titled
Subject: Docs/ABI/damon: update for sz_ops_filter_passed_last
has been added to the -mm mm-new branch. Its filename is
docs-abi-damon-update-for-sz_ops_filter_passed_last.patch

This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/docs-abi-damon-update-for-sz_ops_filter_passed_last.patch

This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Note, mm-new is a provisional staging ground for work-in-progress patches, and acceptance into mm-new is a notification for others take notice and to finish up reviews. Please do not hesitate to respond to review feedback and post updated versions to replace or incrementally fixup patches in mm-new.

The mm-new branch of mm.git is not included in linux-next

If a few days of testing in mm-new is successful, the patch will me moved into mm.git's mm-unstable branch, which is included in linux-next

Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next via various branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days

------------------------------------------------------
From: Mattathias Pinchover <[email protected]>
Subject: Docs/ABI/damon: update for sz_ops_filter_passed_last
Date: Mon, 23 Nov 2026 07:13:07 -0800

Update DAMON ABI document for the newly added DAMOS stat file, sz_ops_filter_passed_last.

 Documentation/ABI/testing/sysfs-kernel-mm-damon |    7 +++++++
 1 file changed, 7 insertions(+)
Documentation/ABI/testing/sysfs-kernel-mm-damon renamed from Documentation/ABI/testing/sysfs-kernel-mm-damon~docs-abi-damon-update-for-sz_ops_filter_passed_last +7 -0
@@ -623,6 +623,13 @@ Contact:	SJ Park <[email protected]>
 Description:	Reading this file returns the total size of memory that passed
 		DAMON operations layer-handled filters of the scheme in bytes.
 
+What:		/sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/stats/sz_ops_filter_passed_last
+Date:		Nov 2026
+Contact:	SJ Park <[email protected]>
+Description:	Reading this file returns the size of memory that passed DAMON
+		operations layer-handled filters of the scheme in bytes, in the
+		last apply interval of the scheme.
+
 What:		/sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/stats/qt_exceeds
 Date:		Mar 2022
 Contact:	SJ Park <[email protected]>

_

Patches currently in -mm which might be from [email protected] are

mm-damon-core-introduce-sz_ops_filter_passed_last-stat.patch mm-damon-sysfs-schemes-add-sz_ops_filter_passed_last-file.patch mm-damon-tests-core-kunit-test-sz_ops_filter_passed_last.patch docs-mm-damon-design-update-for-sz_ops_filter_passed_last.patch docs-admin-guide-mm-damon-usage-update-for-sz_ops_filter_passed_last.patch docs-abi-damon-update-for-sz_ops_filter_passed_last.patch