[PATCH 1/2] mm/damon/core: score an unmeasured PSI goal as not achieved for the temporal tuner
From: Karl Mehltretter
Date: Tue Sep 15 2026 - 02:10:39 EST
A newly created or committed PSI quota goal has no previous sample.
Commit a68878f83ae6 ("mm/damon/core: handle uninitialized
damos_quota_goal->last_psi_total") scores the first tuning round as
achieved to preserve the consist tuner's quota, since the feedback
loop returns its input unchanged at that score.
The temporal tuner sets the quota to zero for an achieved goal. This
skips the first charge window and the window after each goal commit.
Committing the PSI goal before every tuning round keeps the scheme
idle indefinitely.
Score an unmeasured PSI goal as not achieved for the temporal tuner,
so a new scheme can run in its first window. Keep the consist tuner's
behaviour unchanged.
Fixes: a68878f83ae6 ("mm/damon/core: handle uninitialized damos_quota_goal->last_psi_total")
Cc: <stable@xxxxxxxxxxxxxxx> # 7.1.x
Assisted-by: LLM
Signed-off-by: Karl Mehltretter <kmehltretter@xxxxxxxxx>
---
mm/damon/core.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/mm/damon/core.c b/mm/damon/core.c
index 06cf2ab7e97d..e6d87fd3992e 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -3161,12 +3161,18 @@ static void damos_set_quota_goal_current_value(struct damon_ctx *c,
break;
case DAMOS_QUOTA_SOME_MEM_PSI_US:
now_psi_total = damos_get_some_mem_psi_total();
- /* uninitialized last_psi_total; make no effect this round */
- if (goal->last_psi_total == U64_MAX)
- goal->current_value = goal->target_value;
- else
+ if (goal->last_psi_total == U64_MAX) {
+ /* uninitialized last_psi_total; make no effect this round */
+ if (s->quota.goal_tuner ==
+ DAMOS_QUOTA_GOAL_TUNER_TEMPORAL)
+ /* an achieved score would zero the temporal quota */
+ goal->current_value = 0;
+ else
+ goal->current_value = goal->target_value;
+ } else {
goal->current_value = now_psi_total -
goal->last_psi_total;
+ }
goal->last_psi_total = now_psi_total;
break;
case DAMOS_QUOTA_NODE_MEM_USED_BP:
--
2.53.0