Skip to contentSkip to conversation

mm/damon: cleanup code, add test cases, and update guidances in docs

PATCH Applied SJ Park 4 participants 42 messages Sep 2 – Sep 3

Subsystems (5)
lore
Share & tools
lore

SJ Park

author maintainer
#0 lore raw

cover mm/damon: cleanup code, add test cases, and update guidances in docs

Misc cleanup, improvements and updates of code, test, and documents.

Patches 1-5 cleanup DAMON code. Patches 6-10 adds kunit and selftest test cases for recently fixed bugs and a new feature. Patches 11 and 12 update guidelines for AI review and what document to read, on DAMON documents.

Changes from RFC v1.2
- RFC v1.2: https://lore.kernel.org/[email protected]
- Drop RFC tag.
- Rebase to latest mm-new.
Changes from RFC v1.1
- RFC v1.1: https://lore.kernel.org/[email protected]
- Fix a typo: s/alingment/alignment/.
- Add damon probes parameter validation cleanup (patches 4 and 5). Changes from RFC
- RFC: https://lore.kernel.org/[email protected]
- Remove ctx parameter of __damon_va_init_regions().
- Fix damon_nr_samples_per_aggr() overflow kunit test.
- Rebase to the latest mm-new.

SJ Park (12):
mm/damon/core: use damon_nr_samples_per_aggr() for max merge threshold mm/damon/core: remove debug messages
mm/damon/vaddr: remove a debug message
mm/damon/core: validate number of probes in valid_probe_params() mm/damon/sysfs: remove probes number validation mm/damon/tests/core-kunit: extend set_regions() test for error case mm/damon/tests/core-kunit: test <=0 size damon_set_regions() inputs mm/damon/tests/core-kunit: test overlapping ranges for set_regions() mm/damon/tests/core-kunit: test damon_nr_samples_per_aggr() selftests/damon/sysfs.sh: test hugepage_mem_bp quota goal Docs/mm/damon/maintainer-profile: update AI review for Sashiko replies Docs/ABI/damon: recommend subsystem doc instead of admin-guide

 .../ABI/testing/sysfs-kernel-mm-damon         |  2 +-
 Documentation/mm/damon/maintainer-profile.rst | 19 ++----
 mm/damon/core.c                               | 19 +++---
 mm/damon/sysfs.c                              |  2 +-
 mm/damon/tests/core-kunit.h                   | 65 ++++++++++++++++---
 mm/damon/vaddr.c                              | 16 +----
 tools/testing/selftests/damon/sysfs.sh        |  1 +
 7 files changed, 76 insertions(+), 48 deletions(-)

base-commit: 52315e1a031f7370a286d6f6c805e2c8eab5abbc

Signature · 1 line
2.47.3
author maintainer
#1 lore raw

PATCH 1/12 mm/damon/core: use damon_nr_samples_per_aggr() for max merge threshold

kdamond_merge_regions() open-codes max region merge threshold calculation. What it does is fundamentally the same as damon_nr_samples_per_aggr() but missing a few corner cases. The unhandled corner cases should be rare and make only a negligible level of monitoring results degradation. But having the inconsistency could increase future maintenance burden. Use the dedicated function.

---
 mm/damon/core.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
mm/damon/core.c +1 -2
index f748acd6bbd5b..846da6df5b552 100644
@@ -3509,8 +3509,7 @@ static void kdamond_merge_regions(struct damon_ctx *c, unsigned int threshold,
 	unsigned int max_thres;
 	bool count_age = true;
 
-	max_thres = c->attrs.aggr_interval /
-		(c->attrs.sample_interval ?  c->attrs.sample_interval : 1);
+	max_thres = damon_nr_samples_per_aggr(&c->attrs);
 	while (true) {
 		nr_regions = 0;
 		damon_for_each_target(t, c) {
Signature · 1 line
2.47.3
#2 lore raw

Re: [PATCH 01/12] mm/damon/core: use damon_nr_samples_per_aggr() for max merge threshold

Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 8 lines

kdamond_merge_regions() open-codes max region merge threshold calculation. What it does is fundamentally the same as damon_nr_samples_per_aggr() but missing a few corner cases. The unhandled corner cases should be rare and make only a negligible level of monitoring results degradation. But having the inconsistency could increase future maintenance burden. Use the dedicated function.

Sashiko has reviewed this patch and found no issues. It looks great!

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Reviewed-by on v1 1/12
#3 lore raw

Re: [PATCH 01/12] mm/damon/core: use damon_nr_samples_per_aggr() for max merge threshold

In reply to SJ Park
Quoted 17 lines · On Tue, 1 Sep 2026 22:47:34 -0700 SJ Park <[email protected]> wrote:

kdamond_merge_regions() open-codes max region merge threshold calculation. What it does is fundamentally the same as damon_nr_samples_per_aggr() but missing a few corner cases. The unhandled corner cases should be rare and make only a negligible level of monitoring results degradation. But having the inconsistency could increase future maintenance burden. Use the dedicated function.

---
 mm/damon/core.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
mm/damon/core.c +0 -0
index f748acd6bbd5b..846da6df5b552 100644

mm/damon/core.c static void kdamond_merge_regions(struct damon_ctx *c, unsigned int threshold, · line 3512

Quoted 6 lines
mm/damon/core.c +1 -2
@@ -3509,8 +3509,7 @@ static void kdamond_merge_regions(struct damon_ctx *c, unsigned int threshold,
 	unsigned int max_thres;
 	bool count_age = true;
 
-	max_thres = c->attrs.aggr_interval /
-		(c->attrs.sample_interval ?  c->attrs.sample_interval : 1);
+	max_thres = damon_nr_samples_per_aggr(&c->attrs);

The helper replacement makes sense to me, and it also keeps the corner-case handling centralized.

Thanks,
Kunwu

Quoted 6 lines
mm/damon/core.c +0 -0
 	while (true) {
 		nr_regions = 0;
 		damon_for_each_target(t, c) {
Signature · 1 line
2.47.3

Sent using hkml (https://github.com/sjp38/hackermail)

author maintainer
#4 lore raw

PATCH 2/12 mm/damon/core: remove debug messages

In reply to SJ Park

There are a few debug messages in DAMON core. Those have not really been used in a meaningful way for the last few years, though. Remove those.

---
 mm/damon/core.c | 9 ---------
 1 file changed, 9 deletions(-)
mm/damon/core.c +0 -9
index 846da6df5b552..4d28eb033fc4a 100644
@@ -3732,10 +3732,6 @@ static unsigned long damos_wmark_wait_us(struct damos *scheme)
 
 	/* higher than high watermark or lower than low watermark */
 	if (metric > scheme->wmarks.high || scheme->wmarks.low > metric) {
-		if (scheme->wmarks.activated)
-			pr_debug("deactivate a scheme (%d) for %s wmark\n",
-				 scheme->action,
-				 str_high_low(metric > scheme->wmarks.high));
 		scheme->wmarks.activated = false;
 		return scheme->wmarks.interval;
 	}
@@ -3745,8 +3741,6 @@ static unsigned long damos_wmark_wait_us(struct damos *scheme)
 			!scheme->wmarks.activated)
 		return scheme->wmarks.interval;
 
-	if (!scheme->wmarks.activated)
-		pr_debug("activate a scheme (%d)\n", scheme->action);
 	scheme->wmarks.activated = true;
 	return 0;
 }
@@ -3889,8 +3883,6 @@ static int kdamond_fn(void *data)
 	struct damon_ctx *ctx = data;
 	unsigned long sz_limit = 0;
 
-	pr_debug("kdamond (%d) starts\n", current->pid);
-
 	mutex_lock(&ctx->call_controls_lock);
 	ctx->call_controls_obsolete = false;
 	mutex_unlock(&ctx->call_controls_lock);
@@ -4044,7 +4036,6 @@ static int kdamond_fn(void *data)
 	mutex_unlock(&ctx->walk_control_lock);
 	damos_walk_cancel(ctx);
 
-	pr_debug("kdamond (%d) finishes\n", current->pid);
 	mutex_lock(&ctx->kdamond_lock);
 	ctx->kdamond = NULL;
 	mutex_unlock(&ctx->kdamond_lock);
Signature · 1 line
2.47.3
#5 lore raw

Re: [PATCH 02/12] mm/damon/core: remove debug messages

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] The patch removed the last usage of `str_high_low()` but did not remove the now-unused `#include…

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The patch removed the last usage of str_high_low() but did not remove the now-unused #include <linux/string_choices.h>. --

commit 43d661e4f50bbdfb8a2cca56bf761ac52256d5cd
Author: SJ Park <[email protected]>

mm/damon/core: remove debug messages

This patch removes several unused debug messages from the DAMON core to clean up the code.

mm/damon/core.c static unsigned long damos_wmark_wait_us(struct damos *scheme) · line 3735

Quoted 12 lines
mm/damon/core.c +0 -4
index bda8e23c10560..3e42f370ea67f 100644
@@ -3729,10 +3729,6 @@ static unsigned long damos_wmark_wait_us(struct damos *scheme)
 
 	/* higher than high watermark or lower than low watermark */
 	if (metric > scheme->wmarks.high || scheme->wmarks.low > metric) {
-		if (scheme->wmarks.activated)
-			pr_debug("deactivate a scheme (%d) for %s wmark\n",
-				 scheme->action,
-				 str_high_low(metric > scheme->wmarks.high));

[Severity: Low]
Since this removes the last usage of str_high_low() in mm/damon/core.c, should the include for <linux/string_choices.h> near line 18 also be removed?

Quoted 3 lines
mm/damon/core.c +0 -0
 		scheme->wmarks.activated = false;
 		return scheme->wmarks.interval;
 	}
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
author maintainer
#6 lore raw

Re: [PATCH 02/12] mm/damon/core: remove debug messages

Quoted 18 lines · On Wed, 02 Sep 2026 05:52:09 +0000 [email protected] wrote:

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The patch removed the last usage of str_high_low() but did not remove the now-unused #include <linux/string_choices.h>. --

commit 43d661e4f50bbdfb8a2cca56bf761ac52256d5cd
Author: SJ Park <[email protected]>

mm/damon/core: remove debug messages

This patch removes several unused debug messages from the DAMON core to clean up the code.

Quoted 6 lines
mm/damon/core.c +0 -0
index bda8e23c10560..3e42f370ea67f 100644
@@ -3729,10 +3729,6 @@ static unsigned long damos_wmark_wait_us(struct damos *scheme)
 
Quoted 11 lines

mm/damon/core.c static unsigned long damos_wmark_wait_us(struct damos *scheme) · line 3738

Quoted 6 lines
mm/damon/core.c +0 -4
 	/* higher than high watermark or lower than low watermark */
 	if (metric > scheme->wmarks.high || scheme->wmarks.low > metric) {
-		if (scheme->wmarks.activated)
-			pr_debug("deactivate a scheme (%d) for %s wmark\n",
-				 scheme->action,
-				 str_high_low(metric > scheme->wmarks.high));

[Severity: Low]
Since this removes the last usage of str_high_low() in mm/damon/core.c, should the include for <linux/string_choices.h> near line 18 also be removed?

Good catch. And this is the only finding on this version of this series. Maybe reposting entire series for this small change is too much. I will ask Andrew's help.

Quoted 7 lines
Quoted 4 lines
mm/damon/core.c +0 -0
 		scheme->wmarks.activated = false;
 		return scheme->wmarks.interval;
 	}
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2

Thanks,
SJ

author maintainer
#7 lore raw

Re: [PATCH 02/12] mm/damon/core: remove debug messages

In reply to SJ Park
Quoted 3 lines · On Tue, 1 Sep 2026 22:47:35 -0700 SJ Park <[email protected]> wrote:

There are a few debug messages in DAMON core. Those have not really been used in a meaningful way for the last few years, though. Remove those.

Hi Andrew,

Sashiko found with this patch, string_choices.h can also be excluded. It is the only finding. I guess reposting entire series for the small change is too much? Could you please add below attaching fixup patch when you pick this? Let me know if you prefer reposting.

Thanks,
SJ

=== >8 ===
From b9c86e50efd30bab8c5cb99b3063bd823184b033 Mon Sep 17 00:00:00 2001
From: SJ Park <[email protected]>
Date: Tue, 1 Sep 2026 23:08:16 -0700
Subject: [PATCH] mm/damon/core: remove string_choices.h include

It is no more being used.

---
 mm/damon/core.c | 1 -
 1 file changed, 1 deletion(-)
mm/damon/core.c +0 -1
index a7ed7724c85af..84f6bc634f377 100644
@@ -15,7 +15,6 @@
 #include <linux/sched.h>
 #include <linux/slab.h>
 #include <linux/string.h>
-#include <linux/string_choices.h>
 
 /* for damon_get_folio() used by node eligible memory metrics */
 #include "ops-common.h"

--
2.47.3

author maintainer
#8 lore raw

PATCH 3/12 mm/damon/vaddr: remove a debug message

In reply to SJ Park

There is a debug message in the DAMON virtual address space operation set. It has not really been used in a meaningful way for the last few years, though. Remove it.

---
 mm/damon/vaddr.c | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)
mm/damon/vaddr.c +3 -13
index c8c32b2ae0402..f884d3f78f30a 100644
@@ -189,22 +189,12 @@ static int damon_va_three_regions(struct damon_target *t,
  *   <BIG UNMAPPED REGION 2>
  *   <stack>
  */
-static void __damon_va_init_regions(struct damon_ctx *ctx,
-				     struct damon_target *t)
+static void __damon_va_init_regions(struct damon_target *t)
 {
-	struct damon_target *ti;
 	struct damon_addr_range regions[3];
-	int tidx = 0;
 
-	if (damon_va_three_regions(t, regions)) {
-		damon_for_each_target(ti, ctx) {
-			if (ti == t)
-				break;
-			tidx++;
-		}
-		pr_debug("Failed to get three regions of %dth target\n", tidx);
+	if (damon_va_three_regions(t, regions))
 		return;
-	}
 
 	damon_set_regions(t, regions, 3, DAMON_MIN_REGION_SZ);
 }
@@ -217,7 +207,7 @@ static void damon_va_init(struct damon_ctx *ctx)
 	damon_for_each_target(t, ctx) {
 		/* the user may set the target regions as they want */
 		if (!damon_nr_regions(t))
-			__damon_va_init_regions(ctx, t);
+			__damon_va_init_regions(t);
 	}
 }
 
Signature · 1 line
2.47.3
#9 lore raw

Re: [PATCH 03/12] mm/damon/vaddr: remove a debug message

Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 5 lines

There is a debug message in the DAMON virtual address space operation set. It has not really been used in a meaningful way for the last few years, though. Remove it.

Sashiko has reviewed this patch and found no issues. It looks great!

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
Reviewed-by on v1 3/12
#10 lore raw

Re: [PATCH 03/12] mm/damon/vaddr: remove a debug message

In reply to SJ Park
Quoted 17 lines · On Tue, 1 Sep 2026 22:47:36 -0700 SJ Park <[email protected]> wrote:

There is a debug message in the DAMON virtual address space operation set. It has not really been used in a meaningful way for the last few years, though. Remove it.

---
 mm/damon/vaddr.c | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)
mm/damon/vaddr.c +0 -0
index c8c32b2ae0402..f884d3f78f30a 100644
@@ -189,22 +189,12 @@ static int damon_va_three_regions(struct damon_target *t,
  *   <BIG UNMAPPED REGION 2>
  *   <stack>
  */

mm/damon/vaddr.c static int damon_va_three_regions(struct damon_target *t, · line 200

Quoted 10 lines
mm/damon/vaddr.c +1 -6
-static void __damon_va_init_regions(struct damon_ctx *ctx,
-				     struct damon_target *t)
+static void __damon_va_init_regions(struct damon_target *t)
 {
-	struct damon_target *ti;
 	struct damon_addr_range regions[3];
-	int tidx = 0;
 
-	if (damon_va_three_regions(t, regions)) {
-		damon_for_each_target(ti, ctx) {

Thanks for the cleanup. The debug message was the only user of ctx here, so the signature cleanup follows naturally.

Thanks,
Kunwu

Quoted 23 lines
mm/damon/vaddr.c +2 -7
-			if (ti == t)
-				break;
-			tidx++;
-		}
-		pr_debug("Failed to get three regions of %dth target\n", tidx);
+	if (damon_va_three_regions(t, regions))
 		return;
-	}
 
 	damon_set_regions(t, regions, 3, DAMON_MIN_REGION_SZ);
 }
@@ -217,7 +207,7 @@ static void damon_va_init(struct damon_ctx *ctx)
 	damon_for_each_target(t, ctx) {
 		/* the user may set the target regions as they want */
 		if (!damon_nr_regions(t))
-			__damon_va_init_regions(ctx, t);
+			__damon_va_init_regions(t);
 	}
 }
 
Signature · 1 line
2.47.3

Sent using hkml (https://github.com/sjp38/hackermail)

author maintainer
#11 lore raw

PATCH 4/12 mm/damon/core: validate number of probes in valid_probe_params()

In reply to SJ Park

Each DAMON context is allowed to have only up to DAMON_MAX_PROBES probes. The central place for validating DAMON probe parameters, damon_valid_probe_params(), is not validating the upper limit, though. Do the validation.

---
 mm/damon/core.c | 7 +++++++
 1 file changed, 7 insertions(+)
mm/damon/core.c +7 -0
index 4d28eb033fc4a..c010f686d033e 100644
@@ -1420,6 +1420,13 @@ static bool damon_valid_probe_params(struct damon_ctx *ctx)
 	unsigned char max_probe_hits;
 	struct damon_probe *probe;
 	unsigned int wsum, wsum_to_add;
+	int nr_probes;
+
+	nr_probes = 0;
+	damon_for_each_probe(probe, ctx)
+		nr_probes++;
+	if (nr_probes > DAMON_MAX_PROBES)
+		return false;
 
 	if (!damon_has_probe_weights(ctx))
 		return true;
Signature · 1 line
2.47.3
#12 lore raw

Re: [PATCH 04/12] mm/damon/core: validate number of probes in valid_probe_params()

Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 6 lines

Each DAMON context is allowed to have only up to DAMON_MAX_PROBES probes. The central place for validating DAMON probe parameters, damon_valid_probe_params(), is not validating the upper limit, though. Do the validation.

Sashiko has reviewed this patch and found no issues. It looks great!

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4
Reviewed-by on v1 4/12
#13 lore raw

Re: [PATCH 04/12] mm/damon/core: validate number of probes in valid_probe_params()

In reply to SJ Park
Quoted 15 lines · On Tue, 1 Sep 2026 22:47:37 -0700 SJ Park <[email protected]> wrote:

Each DAMON context is allowed to have only up to DAMON_MAX_PROBES probes. The central place for validating DAMON probe parameters, damon_valid_probe_params(), is not validating the upper limit, though. Do the validation.

---
 mm/damon/core.c | 7 +++++++
 1 file changed, 7 insertions(+)
mm/damon/core.c +0 -0
index 4d28eb033fc4a..c010f686d033e 100644

mm/damon/core.c static bool damon_valid_probe_params(struct damon_ctx *ctx) · line 1429

Quoted 10 lines
mm/damon/core.c +7 -0
@@ -1420,6 +1420,13 @@ static bool damon_valid_probe_params(struct damon_ctx *ctx)
 	unsigned char max_probe_hits;
 	struct damon_probe *probe;
 	unsigned int wsum, wsum_to_add;
+	int nr_probes;
+
+	nr_probes = 0;
+	damon_for_each_probe(probe, ctx)
+		nr_probes++;
+	if (nr_probes > DAMON_MAX_PROBES)
+		return false;

Hi SJ,

Thanks for the explanation.

I agree that DAMON_MAX_PROBES is better enforced in the core layer, so that all callers share the same validation path without duplicating the limit in the sysfs layer.

Thanks,
Kunwu

Quoted 6 lines
mm/damon/core.c +0 -0
 	if (!damon_has_probe_weights(ctx))
 		return true;
Signature · 1 line
2.47.3

Sent using hkml (https://github.com/sjp38/hackermail)

author maintainer
#14 lore raw

PATCH 5/12 mm/damon/sysfs: remove probes number validation

In reply to SJ Park

DAMON sysfs interface is disallowing >DAMON_MAX_PROBES nr_probes input, since DAMON_MAX_PROBES is the upper limit of probes per DAMON context. The core layer is validating the upper limit again, though. It is preferred to let DAMON API callers such as sysfs interface to set parameters in flexible ways, and do parameters validation in the core layer. Drop the duplicated validation in the sysfs interface.

---
 mm/damon/sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/damon/sysfs.c +1 -1
index 7ec14f48d157a..b576e97cbfdb8 100644
@@ -1479,7 +1479,7 @@ static ssize_t nr_probes_store(struct kobject *kobj,
 
 	if (err)
 		return err;
-	if (nr < 0 || nr > DAMON_MAX_PROBES)
+	if (nr < 0)
 		return -EINVAL;
 
 	probes = container_of(kobj, struct damon_sysfs_probes, kobj);
Signature · 1 line
2.47.3
#15 lore raw

Re: [PATCH 05/12] mm/damon/sysfs: remove probes number validation

Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 8 lines

DAMON sysfs interface is disallowing >DAMON_MAX_PROBES nr_probes input, since DAMON_MAX_PROBES is the upper limit of probes per DAMON context. The core layer is validating the upper limit again, though. It is preferred to let DAMON API callers such as sysfs interface to set parameters in flexible ways, and do parameters validation in the core layer. Drop the duplicated validation in the sysfs interface.

Sashiko has reviewed this patch and found no issues. It looks great!

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=5
#16 lore raw

Re: [PATCH 05/12] mm/damon/sysfs: remove probes number validation

In reply to SJ Park
Quoted 17 lines · On Tue, 1 Sep 2026 22:47:38 -0700 SJ Park <[email protected]> wrote:

DAMON sysfs interface is disallowing >DAMON_MAX_PROBES nr_probes input, since DAMON_MAX_PROBES is the upper limit of probes per DAMON context. The core layer is validating the upper limit again, though. It is preferred to let DAMON API callers such as sysfs interface to set parameters in flexible ways, and do parameters validation in the core layer. Drop the duplicated validation in the sysfs interface.

---
 mm/damon/sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/damon/sysfs.c +0 -0
index 7ec14f48d157a..b576e97cbfdb8 100644

mm/damon/sysfs.c static ssize_t nr_probes_store(struct kobject *kobj, · line 1482

Quoted 5 lines
mm/damon/sysfs.c +1 -1
@@ -1479,7 +1479,7 @@ static ssize_t nr_probes_store(struct kobject *kobj,
 
 	if (err)
 		return err;
-	if (nr < 0 || nr > DAMON_MAX_PROBES)
+	if (nr < 0)

Hi SJ,

Thanks for the cleanup.

I was wondering whether DAMON_MAX_PROBES is purely a core invariant or also an interface constraint.

With this change, sysfs allows nr_probes larger than DAMON_MAX_PROBES and damon_sysfs_probes_add_dirs() will start creating probe objects before the configuration is later rejected by damon_valid_probe_params().

Since nr_probes directly controls the number of sysfs objects created, do we still want to keep an early check here?

I agree that the core validation is required for non-sysfs callers, but I am not sure whether this particular limit should be duplicated at the sysfs layer.

Thanks,
Kunwu

Quoted 6 lines
mm/damon/sysfs.c +0 -0
 		return -EINVAL;
 
 	probes = container_of(kobj, struct damon_sysfs_probes, kobj);
Signature · 1 line
2.47.3

Sent using hkml (https://github.com/sjp38/hackermail)

author maintainer
#17 lore raw

Re: [PATCH 05/12] mm/damon/sysfs: remove probes number validation

Quoted 1 line · On Wed, 2 Sep 2026 22:07:13 +0800 Kunwu Chan <[email protected]> wrote:

On Tue, 1 Sep 2026 22:47:38 -0700 SJ Park <[email protected]> wrote:

[...]

Quoted 2 lines

I was wondering whether DAMON_MAX_PROBES is purely a core invariant or also an interface constraint.

Thank you for reviewing my patch and raising this question!

Quoted 6 lines

With this change, sysfs allows nr_probes larger than DAMON_MAX_PROBES and damon_sysfs_probes_add_dirs() will start creating probe objects before the configuration is later rejected by damon_valid_probe_params().

Quoted 6 lines

Since nr_probes directly controls the number of sysfs objects created, do we still want to keep an early check here?

I agree that the core validation is required for non-sysfs callers, but I am not sure whether this particular limit should be duplicated at the sysfs layer.

I agree the user experience may be not that good.

In my humble opinion, however, keeping code simplicity is more important than the user experience here. After all, DAMON_SYSFS is recommended to be used by another high level tools like DAMON user-space tool (damo) rather than human fingers. The user-space tools like damo can do the early check.

Please feel free to let me know if you have any other opinions or questions.

Thanks,
SJ

[...]

Reviewed-by
#18 lore raw

Re: [PATCH 05/12] mm/damon/sysfs: remove probes number validation

Quoted 22 lines · On Wed, 2 Sep 2026 07:37:06 -0700 SJ Park <[email protected]> wrote:
Quoted 1 line · On Wed, 2 Sep 2026 22:07:13 +0800 Kunwu Chan <[email protected]> wrote:

On Tue, 1 Sep 2026 22:47:38 -0700 SJ Park <[email protected]> wrote:

[...]

Quoted 2 lines

I was wondering whether DAMON_MAX_PROBES is purely a core invariant or also an interface constraint.

Thank you for reviewing my patch and raising this question!

Quoted 6 lines

With this change, sysfs allows nr_probes larger than DAMON_MAX_PROBES and damon_sysfs_probes_add_dirs() will start creating probe objects before the configuration is later rejected by damon_valid_probe_params().

Quoted 6 lines

Since nr_probes directly controls the number of sysfs objects created, do we still want to keep an early check here?

I agree that the core validation is required for non-sysfs callers, but I am not sure whether this particular limit should be duplicated at the sysfs layer.

Quoted 8 lines

I agree the user experience may be not that good.

In my humble opinion, however, keeping code simplicity is more important than the user experience here. After all, DAMON_SYSFS is recommended to be used by another high level tools like DAMON user-space tool (damo) rather than human fingers. The user-space tools like damo can do the early check.

Please feel free to let me know if you have any other opinions or questions.

Hi SJ,

Thanks for the explanation.

I agree that keeping the invariant validation in the core layer avoids duplicating the limit in multiple places. Your point about DAMON_SYSFS being mainly consumed by higher-level tools like damo also makes sense.

My concern was mainly about the temporary creation of sysfs probe objects before the configuration is rejected, rather than the user-facing error message. Given that the number of probes is bounded by the core invariant anyway, I agree that keeping the validation centralized is a reasonable trade-off.

Thanks for clarifying.

Thanks,
Kunwu

Quoted 7 lines

Thanks,
SJ

[...]

Sent using hkml (https://github.com/sjp38/hackermail)

author maintainer
#19 lore raw

PATCH 6/12 mm/damon/tests/core-kunit: extend set_regions() test for error case

In reply to SJ Park

damon_test_set_regions_for() is designed to test only success-expected damon_set_regions() calls. Extend it to cover error-expected calls, too.

---
 mm/damon/tests/core-kunit.h | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)
mm/damon/tests/core-kunit.h +10 -8
index af26b3d60957b..2bcf3bafe2e29 100644
@@ -469,11 +469,12 @@ static void damon_test_set_regions_for(struct kunit *test,
 		struct damon_addr_range *old_ranges, int sz_old_ranges,
 		struct damon_addr_range *new_ranges, int sz_new_ranges,
 		unsigned long min_region_sz,
-		struct damon_addr_range *expect_ranges, int sz_expect_ranges)
+		struct damon_addr_range *expect_ranges, int sz_expect_ranges,
+		int expect_err)
 {
 	struct damon_target *t;
 	struct damon_region *r;
-	int i;
+	int i, err;
 
 	t = damon_new_target();
 	if (!t)
@@ -487,7 +488,8 @@ static void damon_test_set_regions_for(struct kunit *test,
 		damon_add_region(r, t);
 	}
 
-	damon_set_regions(t, new_ranges, sz_new_ranges, min_region_sz);
+	err = damon_set_regions(t, new_ranges, sz_new_ranges, min_region_sz);
+	KUNIT_EXPECT_EQ(test, err, expect_err);
 
 	KUNIT_EXPECT_EQ(test, damon_nr_regions(t), sz_expect_ranges);
 	if (damon_nr_regions(t) != sz_expect_ranges) {
@@ -516,7 +518,7 @@ static void damon_test_set_regions(struct kunit *test)
 			(struct damon_addr_range[]){
 			{.start = 5, .end = 15},
 			{.start = 15, .end = 25},
-			}, 2);
+			}, 2, 0);
 	/* Un-intersecting regions should be removed. */
 	damon_test_set_regions_for(test,
 			(struct damon_addr_range[]){
@@ -529,7 +531,7 @@ static void damon_test_set_regions(struct kunit *test)
 			1,
 			(struct damon_addr_range[]){
 			{.start = 18, .end = 23},
-			}, 1);
+			}, 1, 0);
 	/*
 	 * Holes should be filled up with new regions.
 	 *
@@ -550,7 +552,7 @@ static void damon_test_set_regions(struct kunit *test)
 			{.start = 8, .end = 16},
 			{.start = 16, .end = 24},
 			{.start = 24, .end = 28},
-			}, 3);
+			}, 3, 0);
 	/*
 	 * New regions should be able to be appended.
 	 *
@@ -572,7 +574,7 @@ static void damon_test_set_regions(struct kunit *test)
 			{.start = 0, .end = 4},
 			{.start = 4, .end = 15},
 			{.start = 25, .end = 40},
-			}, 3);
+			}, 3, 0);
 	/*
 	 * New regions should be able to be inserted.
 	 *
@@ -595,7 +597,7 @@ static void damon_test_set_regions(struct kunit *test)
 			{.start = 0, .end = 15},
 			{.start = 25, .end = 40},
 			{.start = 44, .end = 50},
-			}, 3);
+			}, 3, 0);
 }
 
 static void damon_test_update_monitoring_result(struct kunit *test)
Signature · 1 line
2.47.3
#20 lore raw

Re: [PATCH 06/12] mm/damon/tests/core-kunit: extend set_regions() test for error case

Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 5 lines

damon_test_set_regions_for() is designed to test only success-expected damon_set_regions() calls. Extend it to cover error-expected calls, too.

Sashiko has reviewed this patch and found no issues. It looks great!

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=6
author maintainer
#21 lore raw

PATCH 7/12 mm/damon/tests/core-kunit: test <=0 size damon_set_regions() inputs

In reply to SJ Park

Commit 1292c0ecb1ca ("mm/damon/core: validate ranges in damon_set_regions()") disallowed passing zero or negative size input ranges to damon_set_regions(). Add kunit test cases for those inputs.

---
 mm/damon/tests/core-kunit.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
mm/damon/tests/core-kunit.h +14 -0
index 2bcf3bafe2e29..3cbbbcbfbef8f 100644
@@ -598,6 +598,20 @@ static void damon_test_set_regions(struct kunit *test)
 			{.start = 25, .end = 40},
 			{.start = 44, .end = 50},
 			}, 3, 0);
+	/* Zero size regions should return -EINVAL. */
+	damon_test_set_regions_for(test,
+			(struct damon_addr_range[]){}, 0,
+			(struct damon_addr_range[]){
+			{.start = 42, .end = 42},
+			}, 1, 1,
+			(struct damon_addr_range[]){}, 0, -EINVAL);
+	/* Negative size regions should return -EINVAL. */
+	damon_test_set_regions_for(test,
+			(struct damon_addr_range[]){}, 0,
+			(struct damon_addr_range[]){
+			{.start = 42, .end = 21},
+			}, 1, 1,
+			(struct damon_addr_range[]){}, 0, -EINVAL);
 }
 
 static void damon_test_update_monitoring_result(struct kunit *test)
Signature · 1 line
2.47.3
#22 lore raw

Re: [PATCH 07/12] mm/damon/tests/core-kunit: test <=0 size damon_set_regions() inputs

Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 5 lines

Commit 1292c0ecb1ca ("mm/damon/core: validate ranges in damon_set_regions()") disallowed passing zero or negative size input ranges to damon_set_regions(). Add kunit test cases for those inputs.

Sashiko has reviewed this patch and found no issues. It looks great!

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=7
author maintainer
#23 lore raw

PATCH 8/12 mm/damon/tests/core-kunit: test overlapping ranges for set_regions()

In reply to SJ Park

Commit 954157679ec3 ("mm/damon/core: disallow overlapping input ranges for damon_set_regions()") disallowed passing overlapping input ranges to damon_set_regions(). Add a kunit test case for the overlapping input.

---
 mm/damon/tests/core-kunit.h | 11 +++++++++++
 1 file changed, 11 insertions(+)
mm/damon/tests/core-kunit.h +11 -0
index 3cbbbcbfbef8f..a4164ac489a61 100644
@@ -612,6 +612,17 @@ static void damon_test_set_regions(struct kunit *test)
 			{.start = 42, .end = 21},
 			}, 1, 1,
 			(struct damon_addr_range[]){}, 0, -EINVAL);
+	/*
+	 * Regions resulting in same region after alignment should return
+	 * -EINVAL.
+	 */
+	damon_test_set_regions_for(test,
+			(struct damon_addr_range[]){}, 0,
+			(struct damon_addr_range[]){
+			{.start = 10, .end = 20},
+			{.start = 20, .end = 30},
+			}, 2, 4096,
+			(struct damon_addr_range[]){}, 0, -EINVAL);
 }
 
 static void damon_test_update_monitoring_result(struct kunit *test)
Signature · 1 line
2.47.3
#24 lore raw

Re: [PATCH 08/12] mm/damon/tests/core-kunit: test overlapping ranges for set_regions()

Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 5 lines

Commit 954157679ec3 ("mm/damon/core: disallow overlapping input ranges for damon_set_regions()") disallowed passing overlapping input ranges to damon_set_regions(). Add a kunit test case for the overlapping input.

Sashiko has reviewed this patch and found no issues. It looks great!

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=8
Reviewed-by on v1 8/12
#25 lore raw

Re: [PATCH 08/12] mm/damon/tests/core-kunit: test overlapping ranges for set_regions()

In reply to SJ Park
Quoted 34 lines · On Tue, 1 Sep 2026 22:47:41 -0700 SJ Park <[email protected]> wrote:

Commit 954157679ec3 ("mm/damon/core: disallow overlapping input ranges for damon_set_regions()") disallowed passing overlapping input ranges to damon_set_regions(). Add a kunit test case for the overlapping input.

---
 mm/damon/tests/core-kunit.h | 11 +++++++++++
 1 file changed, 11 insertions(+)
mm/damon/tests/core-kunit.h +11 -0
index 3cbbbcbfbef8f..a4164ac489a61 100644
@@ -612,6 +612,17 @@ static void damon_test_set_regions(struct kunit *test)
 			{.start = 42, .end = 21},
 			}, 1, 1,
 			(struct damon_addr_range[]){}, 0, -EINVAL);
+	/*
+	 * Regions resulting in same region after alignment should return
+	 * -EINVAL.
+	 */
+	damon_test_set_regions_for(test,
+			(struct damon_addr_range[]){}, 0,
+			(struct damon_addr_range[]){
+			{.start = 10, .end = 20},
+			{.start = 20, .end = 30},
+			}, 2, 4096,
+			(struct damon_addr_range[]){}, 0, -EINVAL);
 }
 
 static void damon_test_update_monitoring_result(struct kunit *test)
Signature · 1 line
2.47.3

Hi SJ,

I reviewed patches 6-8. The test helper extension and the added error cases look correct to me, including the overlap case after range alignment.

Thanks,
Kunwu

Sent using hkml (https://github.com/sjp38/hackermail)

author maintainer
#26 lore raw

PATCH 9/12 mm/damon/tests/core-kunit: test damon_nr_samples_per_aggr()

In reply to SJ Park

damon_max_nr_accesses(), which is a previous version of damon_nr_samples_per_aggr() before the renaming, was wrongly returning zero or random overflowed values for extreme intervals setup. Commit 35d4a3cf70a8 ("mm/damon/ops-common: handle extreme intervals in damon_hot_score()") updated the function to return correct or more valid values. Add a kunit test to ensure it is working as expected.

---
 mm/damon/tests/core-kunit.h | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
mm/damon/tests/core-kunit.h +22 -0
index a4164ac489a61..d0bed01a5b7fe 100644
@@ -625,6 +625,27 @@ static void damon_test_set_regions(struct kunit *test)
 			(struct damon_addr_range[]){}, 0, -EINVAL);
 }
 
+static void damon_test_nr_samples_per_aggr(struct kunit *test)
+{
+	struct damon_attrs attrs = {
+		.sample_interval = 0,
+		.aggr_interval = 0,
+	};
+
+	/* Zero aggregation interval doesn't cause division by zero */
+	KUNIT_EXPECT_EQ(test, damon_nr_samples_per_aggr(&attrs), 1);
+
+	/*
+	 * Too large aggregation interval on 64 bit system doesn't cause
+	 * overflow
+	 */
+	if (ULONG_MAX > UINT_MAX) {
+		attrs.aggr_interval = (unsigned long)UINT_MAX + 1;
+		KUNIT_EXPECT_EQ(test, damon_nr_samples_per_aggr(&attrs),
+				UINT_MAX);
+	}
+}
+
 static void damon_test_update_monitoring_result(struct kunit *test)
 {
 	struct damon_attrs old_attrs = {
@@ -1736,6 +1757,7 @@ static struct kunit_case damon_test_cases[] = {
 	KUNIT_CASE(damon_test_split_above_half_progresses),
 	KUNIT_CASE(damon_test_ops_registration),
 	KUNIT_CASE(damon_test_set_regions),
+	KUNIT_CASE(damon_test_nr_samples_per_aggr),
 	KUNIT_CASE(damon_test_update_monitoring_result),
 	KUNIT_CASE(damon_test_set_attrs),
 	KUNIT_CASE(damon_test_mvsum),
Signature · 1 line
2.47.3
#27 lore raw

Re: [PATCH 09/12] mm/damon/tests/core-kunit: test damon_nr_samples_per_aggr()

Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 8 lines

damon_max_nr_accesses(), which is a previous version of damon_nr_samples_per_aggr() before the renaming, was wrongly returning zero or random overflowed values for extreme intervals setup. Commit 35d4a3cf70a8 ("mm/damon/ops-common: handle extreme intervals in damon_hot_score()") updated the function to return correct or more valid values. Add a kunit test to ensure it is working as expected.

Sashiko has reviewed this patch and found no issues. It looks great!

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=9
#28 lore raw

Re: [PATCH 09/12] mm/damon/tests/core-kunit: test damon_nr_samples_per_aggr()

In reply to SJ Park
Quoted 17 lines · On Tue, 1 Sep 2026 22:47:42 -0700 SJ Park <[email protected]> wrote:

damon_max_nr_accesses(), which is a previous version of damon_nr_samples_per_aggr() before the renaming, was wrongly returning zero or random overflowed values for extreme intervals setup. Commit 35d4a3cf70a8 ("mm/damon/ops-common: handle extreme intervals in damon_hot_score()") updated the function to return correct or more valid values. Add a kunit test to ensure it is working as expected.

---
 mm/damon/tests/core-kunit.h | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
mm/damon/tests/core-kunit.h +0 -0
index a4164ac489a61..d0bed01a5b7fe 100644

mm/damon/tests/core-kunit.h static void damon_test_set_regions(struct kunit *test) · line 634

Quoted 10 lines
mm/damon/tests/core-kunit.h +7 -0
@@ -625,6 +625,27 @@ static void damon_test_set_regions(struct kunit *test)
 			(struct damon_addr_range[]){}, 0, -EINVAL);
 }
 
+static void damon_test_nr_samples_per_aggr(struct kunit *test)
+{
+	struct damon_attrs attrs = {
+		.sample_interval = 0,
+		.aggr_interval = 0,
+	};
+

Hi SJ,

A small question about the first test case.

Both sample_interval and aggr_interval are zero here. Since sample_interval is the denominator in damon_nr_samples_per_aggr(), would it be better to keep aggr_interval non-zero when testing the zero sample_interval case?

This would make the test explicitly cover the divide-by-zero protection. If the aggr_interval == 0 behavior is also worth covering, perhaps it could be tested separately.

Thanks,
Kunwu

Quoted 28 lines
mm/damon/tests/core-kunit.h +15 -0
+	/* Zero aggregation interval doesn't cause division by zero */
+	KUNIT_EXPECT_EQ(test, damon_nr_samples_per_aggr(&attrs), 1);
+
+	/*
+	 * Too large aggregation interval on 64 bit system doesn't cause
+	 * overflow
+	 */
+	if (ULONG_MAX > UINT_MAX) {
+		attrs.aggr_interval = (unsigned long)UINT_MAX + 1;
+		KUNIT_EXPECT_EQ(test, damon_nr_samples_per_aggr(&attrs),
+				UINT_MAX);
+	}
+}
+
 static void damon_test_update_monitoring_result(struct kunit *test)
 {
 	struct damon_attrs old_attrs = {
@@ -1736,6 +1757,7 @@ static struct kunit_case damon_test_cases[] = {
 	KUNIT_CASE(damon_test_split_above_half_progresses),
 	KUNIT_CASE(damon_test_ops_registration),
 	KUNIT_CASE(damon_test_set_regions),
+	KUNIT_CASE(damon_test_nr_samples_per_aggr),
 	KUNIT_CASE(damon_test_update_monitoring_result),
 	KUNIT_CASE(damon_test_set_attrs),
 	KUNIT_CASE(damon_test_mvsum),
Signature · 1 line
2.47.3

Sent using hkml (https://github.com/sjp38/hackermail)

author maintainer
#29 lore raw

Re: [PATCH 09/12] mm/damon/tests/core-kunit: test damon_nr_samples_per_aggr()

Quoted 1 line · On Wed, 2 Sep 2026 23:08:41 +0800 Kunwu Chan <[email protected]> wrote:

On Tue, 1 Sep 2026 22:47:42 -0700 SJ Park <[email protected]> wrote:

[...]

Quoted 8 lines

Both sample_interval and aggr_interval are zero here. Since sample_interval is the denominator in damon_nr_samples_per_aggr(), would it be better to keep aggr_interval non-zero when testing the zero sample_interval case?

This would make the test explicitly cover the divide-by-zero protection. If the aggr_interval == 0 behavior is also worth covering, perhaps it could be tested separately.

Thank you for your review and question, Kunwu!

Yes, that kind of additional test case would be nice. Please feel free to post a patch if you'd like to! :) And no pressure, no rush. I will also consider doing it myself if it seems you are not interested.

Thanks,
SJ

[...]

Reviewed-by
#30 lore raw

Re: [PATCH 09/12] mm/damon/tests/core-kunit: test damon_nr_samples_per_aggr()

Quoted 13 lines · On Wed, 2 Sep 2026 08:19:54 -0700 SJ Park <[email protected]> wrote:
Quoted 1 line · On Wed, 2 Sep 2026 23:08:41 +0800 Kunwu Chan <[email protected]> wrote:

On Tue, 1 Sep 2026 22:47:42 -0700 SJ Park <[email protected]> wrote:

[...]

Quoted 8 lines

Both sample_interval and aggr_interval are zero here. Since sample_interval is the denominator in damon_nr_samples_per_aggr(), would it be better to keep aggr_interval non-zero when testing the zero sample_interval case?

This would make the test explicitly cover the divide-by-zero protection. If the aggr_interval == 0 behavior is also worth covering, perhaps it could be tested separately.

Quoted 5 lines

Thank you for your review and question, Kunwu!

Yes, that kind of additional test case would be nice. Please feel free to post a patch if you'd like to! :) And no pressure, no rush. I will also consider doing it myself if it seems you are not interested.

Thanks for the feedback, SJ!

I will prepare a small follow-up patch for this test clarity improvement.

Thanks,
Kunwu

Quoted 7 lines

Thanks,
SJ

[...]

Sent using hkml (https://github.com/sjp38/hackermail)

author maintainer
#31 lore raw

Re: [PATCH 09/12] mm/damon/tests/core-kunit: test damon_nr_samples_per_aggr()

Quoted 17 lines · On Wed, 2 Sep 2026 23:49:42 +0800 Kunwu Chan <[email protected]> wrote:
Quoted 15 lines · On Wed, 2 Sep 2026 08:19:54 -0700 SJ Park <[email protected]> wrote:
Quoted 1 line · On Wed, 2 Sep 2026 23:08:41 +0800 Kunwu Chan <[email protected]> wrote:

On Tue, 1 Sep 2026 22:47:42 -0700 SJ Park <[email protected]> wrote:

[...]

Quoted 8 lines

Both sample_interval and aggr_interval are zero here. Since sample_interval is the denominator in damon_nr_samples_per_aggr(), would it be better to keep aggr_interval non-zero when testing the zero sample_interval case?

This would make the test explicitly cover the divide-by-zero protection. If the aggr_interval == 0 behavior is also worth covering, perhaps it could be tested separately.

Thank you for your review and question, Kunwu!

Quoted 8 lines
Quoted 3 lines

Yes, that kind of additional test case would be nice. Please feel free to post a patch if you'd like to! :) And no pressure, no rush. I will also consider doing it myself if it seems you are not interested.

Thanks for the feedback, SJ!

I will prepare a small follow-up patch for this test clarity improvement.

Looking forward to!

Quoted 2 lines

Thank you! Also appreciate your R-b: for other patches!

Thanks,
SJ

[...]

author maintainer
#32 lore raw

PATCH 10/12 selftests/damon/sysfs.sh: test hugepage_mem_bp quota goal

In reply to SJ Park

DAMON sysfs quota goal target_metric file now accepts 'hugepage_mem_bp' input. Test it is accepted in fundamental DAMON sysfs file operation selftest.

---
 tools/testing/selftests/damon/sysfs.sh | 1 +
 1 file changed, 1 insertion(+)
tools/testing/selftests/damon/sysfs.sh +1 -0
index ddebde6edabe4..b66593c9ac471 100755
@@ -210,6 +210,7 @@ test_goal()
 	ensure_write_succ "$fpath" "active_mem_bp" "valid input"
 	ensure_write_succ "$fpath" "inactive_mem_bp" "valid input"
 	ensure_write_succ "$fpath" "node_eligible_mem_bp" "valid input"
+	ensure_write_succ "$fpath" "hugepage_mem_bp" "valid input"
 	ensure_write_fail "$fpath" "foo" "invalid input"
 	ensure_file "$goal_dir/nid" "exist" "600"
 	ensure_file "$goal_dir/path" "exist" "600"
Signature · 1 line
2.47.3
#33 lore raw

Re: [PATCH 10/12] selftests/damon/sysfs.sh: test hugepage_mem_bp quota goal

Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 5 lines

DAMON sysfs quota goal target_metric file now accepts 'hugepage_mem_bp' input. Test it is accepted in fundamental DAMON sysfs file operation selftest.

Sashiko has reviewed this patch and found no issues. It looks great!

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=10
Reviewed-by on v1 10/12
#34 lore raw

Re: [PATCH 10/12] selftests/damon/sysfs.sh: test hugepage_mem_bp quota goal

In reply to SJ Park
Quoted 24 lines · On Tue, 1 Sep 2026 22:47:43 -0700 SJ Park <[email protected]> wrote:

DAMON sysfs quota goal target_metric file now accepts 'hugepage_mem_bp' input. Test it is accepted in fundamental DAMON sysfs file operation selftest.

---
 tools/testing/selftests/damon/sysfs.sh | 1 +
 1 file changed, 1 insertion(+)
tools/testing/selftests/damon/sysfs.sh +1 -0
index ddebde6edabe4..b66593c9ac471 100755
@@ -210,6 +210,7 @@ test_goal()
 	ensure_write_succ "$fpath" "active_mem_bp" "valid input"
 	ensure_write_succ "$fpath" "inactive_mem_bp" "valid input"
 	ensure_write_succ "$fpath" "node_eligible_mem_bp" "valid input"
+	ensure_write_succ "$fpath" "hugepage_mem_bp" "valid input"
 	ensure_write_fail "$fpath" "foo" "invalid input"
 	ensure_file "$goal_dir/nid" "exist" "600"
 	ensure_file "$goal_dir/path" "exist" "600"
Signature · 1 line
2.47.3

The added test correctly covers the
hugepage_mem_bp quota goal.

Thanks,
Kunwu

Sent using hkml (https://github.com/sjp38/hackermail)

author maintainer
#35 lore raw

PATCH 11/12 Docs/mm/damon/maintainer-profile: update AI review for Sashiko replies

In reply to SJ Park

In the past, sharing Sashiko review results was tedious. Also it was suggested to minimize the recipients on the sharing mails. Hence the AI review section of DAMON maintainer profile document was updated to give guidance about available tools for making the sharing easier, and how the recipients list should be managed.

Now DAMON is onboarded [1] to Sashiko's automatic review replies feature. Sashiko directly sends its reviews as replies to the patch mail thread. It also reduces the recipients list to deliver the reporting to only the author and the mailing list.

Remove the old guidance that is no more necessary but only confusing.

[1] https://github.com/sashiko-dev/sashiko/commit/b554c7b6e733

---
 Documentation/mm/damon/maintainer-profile.rst | 19 +++++--------------
 1 file changed, 5 insertions(+), 14 deletions(-)
Documentation/mm/damon/maintainer-profile.rst +5 -14
index fb2fa00cc9aa1..a7c1352339378 100644
@@ -106,18 +106,9 @@ AI Review
 
 For patches that are publicly posted to DAMON mailing list
 ([email protected]), AI reviews of the patches will be available at
-sashiko.dev.  The reviews could also be sent as mails to the author of the
-patch.
-
-Patch authors are encouraged to check the AI reviews and share their opinions.
-The sharing could be done as a reply to the mail thread.  Consider reducing the
-recipients list for such sharing, since some people are not really interested
-in AI reviews.  As a rule of thumb, drop [email protected] and individuals
-except DAMON maintainer.
-
-`hkml` also provides a `feature
-<https://github.com/sjp38/hackermail/blob/master/USAGE.md#forwarding-sashikodev-statuscomments-to-mailing-list>`_
-for such sharing.  Please feel free to use the feature.
+sashiko.dev.  The reviews will also be sent as replies to the author of the
+patch and the mailing list.
 
-It is only an optional recommendation.  DAMON maintainer could also ask any
-question about the AI reviews, though.
+Patch authors are encouraged to check the AI reviews and share their opinions
+by replying on the mail thread.  It is only an optional recommendation.  DAMON
+maintainer could also ask any question about the AI reviews, though.
Signature · 1 line
2.47.3
#36 lore raw

Re: [PATCH 11/12] Docs/mm/damon/maintainer-profile: update AI review for Sashiko replies

Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 11 lines

In the past, sharing Sashiko review results was tedious. Also it was suggested to minimize the recipients on the sharing mails. Hence the AI review section of DAMON maintainer profile document was updated to give guidance about available tools for making the sharing easier, and how the recipients list should be managed.

Now DAMON is onboarded [1] to Sashiko's automatic review replies feature. Sashiko directly sends its reviews as replies to the patch mail thread. It also reduces the recipients list to deliver the reporting to only the author and the mailing list.

Quoted 5 lines

Remove the old guidance that is no more necessary but only confusing.

[1] https://github.com/sashiko-dev/sashiko/commit/b554c7b6e733

Sashiko has reviewed this patch and found no issues. It looks great!

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=11
author maintainer
#37 lore raw

PATCH 12/12 Docs/ABI/damon: recommend subsystem doc instead of admin-guide

In reply to SJ Park

DAMON ABI doc is recommending DAMON admin-guide for people who are willing to know further about DAMON. Nowadays the subsystem doc (Documentation/mm/damon) is a more recommended place for even beginners. Recommend the subsystem doc over admin-guide.

---
 Documentation/ABI/testing/sysfs-kernel-mm-damon | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/ABI/testing/sysfs-kernel-mm-damon +1 -1
index f8d2601e82904..ad21f58f3c912 100644
@@ -3,7 +3,7 @@ Date:		Mar 2022
 Contact:	SJ Park <[email protected]>
 Description:	Interface for Data Access MONitoring (DAMON).  Contains files
 		for controlling DAMON.  For more details on DAMON itself,
-		please refer to Documentation/admin-guide/mm/damon/index.rst.
+		please refer to Documentation/mm/damon/index.rst.
 
 What:		/sys/kernel/mm/damon/admin/
 Date:		Mar 2022
Signature · 1 line
2.47.3
#38 lore raw

Re: [PATCH 12/12] Docs/ABI/damon: recommend subsystem doc instead of admin-guide

Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 6 lines

DAMON ABI doc is recommending DAMON admin-guide for people who are willing to know further about DAMON. Nowadays the subsystem doc (Documentation/mm/damon) is a more recommended place for even beginners. Recommend the subsystem doc over admin-guide.

Sashiko has reviewed this patch and found no issues. It looks great!

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=12
Reviewed-by on v1 12/12
#39 lore raw

Re: [PATCH 12/12] Docs/ABI/damon: recommend subsystem doc instead of admin-guide

In reply to SJ Park
Quoted 26 lines · On Tue, 1 Sep 2026 22:47:45 -0700 SJ Park <[email protected]> wrote:

DAMON ABI doc is recommending DAMON admin-guide for people who are willing to know further about DAMON. Nowadays the subsystem doc (Documentation/mm/damon) is a more recommended place for even beginners. Recommend the subsystem doc over admin-guide.

---
 Documentation/ABI/testing/sysfs-kernel-mm-damon | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/ABI/testing/sysfs-kernel-mm-damon +1 -1
index f8d2601e82904..ad21f58f3c912 100644
@@ -3,7 +3,7 @@ Date:		Mar 2022
 Contact:	SJ Park <[email protected]>
 Description:	Interface for Data Access MONitoring (DAMON).  Contains files
 		for controlling DAMON.  For more details on DAMON itself,
-		please refer to Documentation/admin-guide/mm/damon/index.rst.
+		please refer to Documentation/mm/damon/index.rst.
 
 What:		/sys/kernel/mm/damon/admin/
 Date:		Mar 2022
Signature · 1 line
2.47.3

Thanks,
Kunwu

Sent using hkml (https://github.com/sjp38/hackermail)

author maintainer
#40 lore raw
In reply to SJ Park
Quoted 1 line · On Tue, 1 Sep 2026 22:47:33 -0700 SJ Park <[email protected]> wrote:

Misc cleanup, improvements and updates of code, test, and documents.

Sashiko found one better-to-do change for patch 2. Since it is quite trivial in my opinion, I asked Andrew to pick a fixup patch as a reply to the patch 2. Andrew, please feel free to let me know if you prefer reposting.

Sashiko sent findings to damon@ mailing list [1], and I replied to all the comments having some findings. Please read those for details.

[1] https://lore.kernel.org/damon/

Thanks,
SJ

[...]

maintainer
#41 lore raw
In reply to SJ Park
Quoted 6 lines · On Tue, 1 Sep 2026 22:47:33 -0700 SJ Park <[email protected]> wrote:

Misc cleanup, improvements and updates of code, test, and documents.

Patches 1-5 cleanup DAMON code. Patches 6-10 adds kunit and selftest test cases for recently fixed bugs and a new feature. Patches 11 and 12 update guidelines for AI review and what document to read, on DAMON documents.

Thanks, I added all this. Along with the fixup for [02/12].