Skip to contentSkip to conversation

mm/damon: Remove duplicate attrs.intervals_goal at the damon_stat_build_ctx()

PATCH In review Jung-JaeJoon 2 participants 3 messages Dec 3, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm/damon: Remove duplicate attrs.intervals_goal at the 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. Please check the modified code below:

---
 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
maintainer Reviewed-by on v1 1/1
#1 lore raw

+ [email protected]

Please Cc [email protected] for DAMON patches from next time.

Quoted 6 lines · On Wed, 3 Dec 2025 12:33:48 +0900 Jung-JaeJoon <[email protected]> wrote:

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.

Thank you for finding and fixing this!

Quoted 1 line

Please check the modified code below:

The above sentence is not needed for normal patch descriptions. Please drop it.

Also, I think the subject could be better describe this change, e.g.,

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

Could you please make the above suggested changes to this patch and resend the modified version as v2?

Quoted 2 lines

If you agree to my above trivial suggestions and make the requested changes, please feel free to add below on the v2 patch.

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;
 
Signature · 1 line
2.43.0

Thanks,
SJ

[...]

#2 lore raw

Hi, SeongJae Park,
Thank you for your kind reply.
I will send you the v2 patch incorporating the advice you provided above. Thanks.

Quoted 67 lines · SeongJae Park

+ [email protected]

Please Cc [email protected] for DAMON patches from next time.

Quoted 6 lines · On Wed, 3 Dec 2025 12:33:48 +0900 Jung-JaeJoon <[email protected]> wrote:

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.

Thank you for finding and fixing this!

Quoted 1 line

Please check the modified code below:

The above sentence is not needed for normal patch descriptions. Please drop it.

Also, I think the subject could be better describe this change, e.g.,

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

Could you please make the above suggested changes to this patch and resend the modified version as v2?

Quoted 2 lines

If you agree to my above trivial suggestions and make the requested changes, please feel free to add below on the v2 patch.

Quoted 24 lines
---
 mm/damon/stat.c | 8 --------
 1 file changed, 8 deletions(-)
mm/damon/stat.c +0 -9
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;
 
--
Quoted 1 line

2.43.0

Thanks,
SJ

[...]