[RFC PATCH v3 1/4] mm/damon/sysfs: set goal_tuner after scheme creation
From: Ravi Jonnalagadda
Date: Mon Feb 23 2026 - 07:33:39 EST
damon_new_scheme() always sets quota.goal_tuner to CONSIST (the default)
regardless of what was passed in the quota struct. This caused the sysfs
goal_tuner setting to be ignored.
The comment in damon_new_scheme() says "quota.goals and .goal_tuner
should be separately set by caller", but the sysfs code wasn't doing
this. Add explicit assignment of goal_tuner after damon_new_scheme()
returns to properly apply the user's setting.
Without this fix, setting goal_tuner to "temporal" via sysfs has no
effect - the scheme always uses the CONSIST (feed loop) tuner, causing
overshoot when the goal is reached instead of immediate stop.
Signed-off-by: Ravi Jonnalagadda <ravis.opensrc@xxxxxxxxx>
---
mm/damon/sysfs-schemes.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/mm/damon/sysfs-schemes.c b/mm/damon/sysfs-schemes.c
index bbea908074bb..fe2e3b2db9e1 100644
--- a/mm/damon/sysfs-schemes.c
+++ b/mm/damon/sysfs-schemes.c
@@ -2809,6 +2809,9 @@ static struct damos *damon_sysfs_mk_scheme(
if (!scheme)
return NULL;
+ /* Set goal_tuner after damon_new_scheme() as it defaults to CONSIST */
+ scheme->quota.goal_tuner = sysfs_quotas->goal_tuner;
+
err = damos_sysfs_add_quota_score(sysfs_quotas->goals, &scheme->quota);
if (err) {
damon_destroy_scheme(scheme);
--
2.43.0