[PATCH] mm/damon/core: fix quota could not be set to zero
From: Liew Rui Yan
Date: Tue Sep 01 2026 - 07:06:34 EST
When the temporal quota goal tuner determines that the goal has been
achieved (score >= 10000), it sets esz_bp to zero so that the effective
quota becomes error. However, damos_set_effective_quota()
unconditionally clamps the quota to min_region_sz, preventing the quota
from ever reaching zero.
Fix this by skip the min_region_sz clamping when esz is already zero so
that the temporal tuner's intent is respected.
Fixes: 8bbde987c2b8 ("mm/damon/core: disallow time-quota setting zero esz")
Cc: <stable@xxxxxxxxxxxxxxx> # v7.1.x
Signed-off-by: Liew Rui Yan <aethernet65535@xxxxxxxxx>
---
mm/damon/core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/mm/damon/core.c b/mm/damon/core.c
index 53cf32f1d515..0258769b8727 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -3114,7 +3114,8 @@ static void damos_set_effective_quota(struct damon_ctx *ctx, struct damos *s)
else
throughput = PAGE_SIZE * 1024;
esz = min(throughput * quota->ms, esz);
- esz = max(ctx->min_region_sz, esz);
+ if (esz)
+ esz = max(ctx->min_region_sz, esz);
}
if (quota->sz && quota->sz < esz)
--
2.55.0