The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] mm/damon/core: recalculate intervals tuning deadline on attrs update
@ 2026-05-14  7:48 niecheng
  2026-05-14 14:41 ` SeongJae Park
  0 siblings, 1 reply; 4+ messages in thread
From: niecheng @ 2026-05-14  7:48 UTC (permalink / raw)
  To: sj; +Cc: akpm, damon, linux-mm, linux-kernel, kernel, niecheng

damon_set_attrs() refreshes next_aggregation_sis and
next_ops_update_sis for online monitoring attribute updates, but it
does not refresh next_intervals_tune_sis.

Because of that, enabling intervals auto-tuning via an online attrs
commit can leave next_intervals_tune_sis stale.  If a context starts
with intervals_goal.aggrs == 0 and later updates attrs online to set it
non-zero, kdamond_fn() can treat the tuning deadline as already expired
and tune the intervals earlier than intended.

This has been possible since the intervals auto-tuning feature was
introduced, because that commit initialized the deadline at kdamond
start but did not refresh it on later attrs updates.

Fix it by recalculating next_intervals_tune_sis in damon_set_attrs(),
using the same passed_sample_intervals-based schedule as the other
runtime deadlines.

Fixes: f04b0fedbe71 ("mm/damon/core: implement intervals auto-tuning")
Signed-off-by: niecheng <niecheng1@uniontech.com>
---
 mm/damon/core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mm/damon/core.c b/mm/damon/core.c
index 3dbbbfdeff71..501694d4a590 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -797,6 +797,8 @@ int damon_set_attrs(struct damon_ctx *ctx, struct damon_attrs *attrs)
 		attrs->aggr_interval / sample_interval;
 	ctx->next_ops_update_sis = ctx->passed_sample_intervals +
 		attrs->ops_update_interval / sample_interval;
+	ctx->next_intervals_tune_sis = ctx->passed_sample_intervals +
+		attrs->aggr_samples * attrs->intervals_goal.aggrs;
 
 	damon_update_monitoring_results(ctx, attrs, aggregating);
 	ctx->attrs = *attrs;
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-05-14 16:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-14  7:48 [PATCH] mm/damon/core: recalculate intervals tuning deadline on attrs update niecheng
2026-05-14 14:41 ` SeongJae Park
2026-05-14 16:15   ` niecheng
2026-05-14 16:37   ` [PATCH] mm/damon/core: clarify next_intervals_tune_sis update path niecheng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox