[PATCH] mm/damon/core: fix quota could not be set to zero

Liew Rui Yan posted 1 patch 3 weeks, 4 days ago
mm/damon/core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
[PATCH] mm/damon/core: fix quota could not be set to zero
Posted by Liew Rui Yan 3 weeks, 4 days ago
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@vger.kernel.org> # v7.1.x
Signed-off-by: Liew Rui Yan <aethernet65535@gmail.com>
---
 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
Re: [PATCH] mm/damon/core: fix quota could not be set to zero
Posted by SJ Park 3 weeks, 3 days ago
Hi Liew,


Seems Sashiko found something and you are planning to revision this patch that.
I will hold review until the next version is posted.  Same for your other patch
that sent in the same time.


Thanks,
SJ

[...]