All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: mm-commits@vger.kernel.org,sj@kernel.org,davidgow@davidgow.net,
	brendan.higgins@linux.dev,mattathias.pinchover@uber.com,
	akpm@linux-foundation.org
Subject: + mm-damon-tests-core-kunit-test-sz_ops_filter_passed_last.patch added to mm-new branch
Date: Mon, 23 Nov 2026 09:28:44 -0800	[thread overview]
Message-ID: <20261123172844.DAEE11F000C0@smtp.kernel.org> (raw)
In-Reply-To: <20261123151309.82675-4-sj@kernel.org>


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 <mattathias.pinchover@uber.com>
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.

Link: https://patch.msgid.link/20261123151309.82675-4-sj@kernel.org
Signed-off-by: Mattathias Pinchover <mattathias.pinchover@uber.com>
Signed-off-by: SJ Park <sj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: SJ Park <sj@kernel.org>
Cc: Brendan Higgins <brendan.higgins@linux.dev>
Cc: David Gow <davidgow@davidgow.net>

 mm/damon/tests/core-kunit.h |   93 ++++++++++++++++++++++++++++++++++
 1 file changed, 93 insertions(+)

--- a/mm/damon/tests/core-kunit.h~mm-damon-tests-core-kunit-test-sz_ops_filter_passed_last
+++ a/mm/damon/tests/core-kunit.h
@@ -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 mattathias.pinchover@uber.com 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


  reply	other threads:[~2026-11-23 17:28 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 1/6] mm/damon/core: introduce sz_ops_filter_passed_last stat SJ Park
2026-11-23 17:28   ` + mm-damon-core-introduce-sz_ops_filter_passed_last-stat.patch added to mm-new branch Andrew Morton
2026-11-23 15:13 ` [PATCH v3 2/6] mm/damon/sysfs-schemes: add sz_ops_filter_passed_last file SJ Park
2026-11-23 17:28   ` + mm-damon-sysfs-schemes-add-sz_ops_filter_passed_last-file.patch added to mm-new branch Andrew Morton
2026-11-23 15:13 ` [PATCH v3 3/6] mm/damon/tests/core-kunit: test sz_ops_filter_passed_last SJ Park
2026-11-23 17:28   ` Andrew Morton [this message]
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 17:28   ` + docs-mm-damon-design-update-for-sz_ops_filter_passed_last.patch added to mm-new branch Andrew Morton
2026-11-23 15:13 ` [PATCH v3 5/6] Docs/admin-guide/mm/damon/usage: update for sz_ops_filter_passed_last SJ Park
2026-11-23 17:28   ` + docs-admin-guide-mm-damon-usage-update-for-sz_ops_filter_passed_last.patch added to mm-new branch Andrew Morton
2026-11-23 15:13 ` [PATCH v3 6/6] Docs/ABI/damon: update for sz_ops_filter_passed_last SJ Park
2026-11-23 17:28   ` + docs-abi-damon-update-for-sz_ops_filter_passed_last.patch added to mm-new branch Andrew Morton
2026-11-23 15:19 ` [PATCH v3 0/6] mm/damon: add sz_ops_filter_passed_last DAMOS stat sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261123172844.DAEE11F000C0@smtp.kernel.org \
    --to=akpm@linux-foundation.org \
    --cc=brendan.higgins@linux.dev \
    --cc=davidgow@davidgow.net \
    --cc=mattathias.pinchover@uber.com \
    --cc=mm-commits@vger.kernel.org \
    --cc=sj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.