[RFC PATCH v3 2/4] mm/damon: fix esz=0 quota bypass allowing unlimited migration
From: Ravi Jonnalagadda
Date: Mon Feb 23 2026 - 07:46:55 EST
When the TEMPORAL goal tuner sets esz_bp=0 to signal that a goal has
been achieved, the quota check was not actually stopping migration.
The condition:
if (quota->esz && quota->charged_sz >= quota->esz)
When esz=0, this evaluates to (false && ...) = false, so the continue
is never executed and migration proceeds without limit.
Change the logic to:
if (!quota->esz || quota->charged_sz >= quota->esz)
Now when esz=0, (!0 = true) causes the continue to execute, properly
stopping migration when the goal is achieved.
This is critical for the TEMPORAL tuner to work correctly - without
this fix, setting esz=0 has no effect and migration continues until
all hot memory is moved, overshooting the target goal.
Signed-off-by: Ravi Jonnalagadda <ravis.opensrc@xxxxxxxxx>
---
mm/damon/core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mm/damon/core.c b/mm/damon/core.c
index 614f1f08eee9..b438355ab54a 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -2394,8 +2394,8 @@ static void damon_do_apply_schemes(struct damon_ctx *c,
if (!s->wmarks.activated)
continue;
- /* Check the quota */
- if (quota->esz && quota->charged_sz >= quota->esz)
+ /* Check the quota: skip if esz=0 (goal achieved) or exhausted */
+ if (!quota->esz || quota->charged_sz >= quota->esz)
continue;
if (damos_skip_charged_region(t, r, s, c->min_region_sz))
--
2.43.0