Skip to contentSkip to conversation

mm/damon/stat: deduplicate intervals_goal setup in damon_stat_build_ctx()

PATCH Superseded Jung-JaeJoon 2 participants 3 messages Dec 3, 2025 – Dec 6, 2025 1 message not in the archive

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 mm/damon/stat: deduplicate intervals_goal setup in damon_stat_build_ctx()

The damon_stat_build_ctx() function sets the values
of attrs.intervals_goal structure members.
These values are applied to damon_ctx in damon_set_attrs(). However, It is resetting the values that were already applied previously to the same values.
I suggest removing this code as it constitutes duplicate execution.

---
 mm/damon/stat.c | 8 --------
 1 file changed, 8 deletions(-)
mm/damon/stat.c +0 -8
index bf8626859902..51dd29685915 100644
@@ -173,14 +173,6 @@ static struct damon_ctx *damon_stat_build_ctx(void)
 	if (damon_set_attrs(ctx, &attrs))
 		goto free_out;
 
-	/*
-	 * auto-tune sampling and aggregation interval aiming 4% DAMON-observed
-	 * accesses ratio, keeping sampling interval in [5ms, 10s] range.
-	 */
-	ctx->attrs.intervals_goal = (struct damon_intervals_goal) {
-		.access_bp = 400, .aggrs = 3,
-		.min_sample_us = 5000, .max_sample_us = 10000000,
-	};
 	if (damon_select_ops(ctx, DAMON_OPS_PADDR))
 		goto free_out;
 
Signature · 1 line
2.43.0
#1 lore raw

Hello JaeJoon,

Thanks for your patch! I've a trivial comment inline, see below.

Quoted 6 lines · Jung-JaeJoon

The damon_stat_build_ctx() function sets the values
of attrs.intervals_goal structure members.
These values are applied to damon_ctx in damon_set_attrs(). However, It is resetting the values that were already applied previously to the same values.
I suggest removing this code as it constitutes duplicate execution.

Would you mind reformatting the patch description? The kernel community documentation recommends wrapping lines at 75 columns [1]. While the current length is within the limit, adjusting it for more balanced line lengths would improve readability. Also, I suggest using two spaces after a period instead of a line break.

[1] https://www.kernel.org/doc/html/latest/process/submitting-patches.html#subject-line

Thanks,
Enze

Quoted 25 lines
---
 mm/damon/stat.c | 8 --------
 1 file changed, 8 deletions(-)
mm/damon/stat.c +0 -8
index bf8626859902..51dd29685915 100644
@@ -173,14 +173,6 @@ static struct damon_ctx *damon_stat_build_ctx(void)
 	if (damon_set_attrs(ctx, &attrs))
 		goto free_out;
 
-	/*
-	 * auto-tune sampling and aggregation interval aiming 4% DAMON-observed
-	 * accesses ratio, keeping sampling interval in [5ms, 10s] range.
-	 */
-	ctx->attrs.intervals_goal = (struct damon_intervals_goal) {
-		.access_bp = 400, .aggrs = 3,
-		.min_sample_us = 5000, .max_sample_us = 10000000,
-	};
 	if (damon_select_ops(ctx, DAMON_OPS_PADDR))
 		goto free_out;

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw

Hello Enze,

Thank you for your kind help. I will reflect it in v3 and send it again.

Thanks,
JaeJoon

Quoted 50 lines · Enze Li

Hello JaeJoon,

Thanks for your patch! I've a trivial comment inline, see below.

Quoted 6 lines · Jung-JaeJoon

The damon_stat_build_ctx() function sets the values
of attrs.intervals_goal structure members.
These values are applied to damon_ctx in damon_set_attrs(). However, It is resetting the values that were already applied previously to the same values.
I suggest removing this code as it constitutes duplicate execution.

Would you mind reformatting the patch description? The kernel community documentation recommends wrapping lines at 75 columns [1]. While the current length is within the limit, adjusting it for more balanced line lengths would improve readability. Also, I suggest using two spaces after a period instead of a line break.

[1] https://www.kernel.org/doc/html/latest/process/submitting-patches.html#subject-line

Thanks,
Enze

Quoted 25 lines
---
 mm/damon/stat.c | 8 --------
 1 file changed, 8 deletions(-)
mm/damon/stat.c +0 -8
index bf8626859902..51dd29685915 100644
@@ -173,14 +173,6 @@ static struct damon_ctx *damon_stat_build_ctx(void)
      if (damon_set_attrs(ctx, &attrs))
              goto free_out;
 
-     /*
-      * auto-tune sampling and aggregation interval aiming 4% DAMON-observed
-      * accesses ratio, keeping sampling interval in [5ms, 10s] range.
-      */
-     ctx->attrs.intervals_goal = (struct damon_intervals_goal) {
-             .access_bp = 400, .aggrs = 3,
-             .min_sample_us = 5000, .max_sample_us = 10000000,
-     };
      if (damon_select_ops(ctx, DAMON_OPS_PADDR))
              goto free_out;