damon.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH 6.18.y 1/2] mm/damon/core: allow esz to be set to zero
@ 2026-09-29 17:44 SJ Park
  2026-09-29 17:44 ` [PATCH 6.18.y 2/2] mm/damon/core: fix unconditionally skip last region SJ Park
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: SJ Park @ 2026-09-29 17:44 UTC (permalink / raw)
  To: stable; +Cc: damon, Liew Rui Yan, SJ Park, Andrew Morton

From: Liew Rui Yan <aethernet65535@gmail.com>

When the temporal quota goal tuner determines that the goal has been
achieved (score >= 10000), it sets esz_bp to zero so that the esz becomes
zero.  However, damos_set_effective_quota() clamps the esz to
min_region_sz when quota->ms is set.

This is a minor issue, the main problem is that it doesn't match the
description in the documentation, which state that if the goal has already
been [over-]achieved, the quota will be set to zero.

Fix this by set quota (esz) as minimum as possible.

Link: https://lore.kernel.org/20260908135413.97570-1-sj@kernel.org
Fixes: 8bbde987c2b8 ("mm/damon/core: disallow time-quota setting zero esz")
Signed-off-by: SJ Park <sj@kernel.org>
Signed-off-by: Liew Rui Yan <aethernet65535@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: SJ Park <sj@kernel.org>
Cc: <stable@vger.kernel.org> # v7.1.x
(cherry picked from commit 90179da203ba8b708c84a12a07cd44be0f346334)
Signed-off-by: SJ Park <sj@kernel.org>
---
 mm/damon/core.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/mm/damon/core.c b/mm/damon/core.c
index 6fa02025d2af1..facb1fa1f695f 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -2191,6 +2191,7 @@ static void damos_set_effective_quota(struct damos_quota *quota,
 {
 	unsigned long throughput;
 	unsigned long esz = ULONG_MAX;
+	unsigned long esz_time;
 
 	if (!quota->ms && list_empty(&quota->goals)) {
 		quota->esz = quota->sz;
@@ -2212,8 +2213,8 @@ static void damos_set_effective_quota(struct damos_quota *quota,
 							quota->total_charged_ns);
 		else
 			throughput = PAGE_SIZE * 1024;
-		esz = min(throughput * quota->ms, esz);
-		esz = max(ctx->min_sz_region, esz);
+		esz_time = max(throughput * quota->ms, ctx->min_sz_region);
+		esz = min(esz_time, esz);
 	}
 
 	if (quota->sz && quota->sz < esz)
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-09-30 12:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-29 17:44 [PATCH 6.18.y 1/2] mm/damon/core: allow esz to be set to zero SJ Park
2026-09-29 17:44 ` [PATCH 6.18.y 2/2] mm/damon/core: fix unconditionally skip last region SJ Park
2026-09-29 17:55   ` sashiko-bot
2026-09-29 17:59 ` [PATCH 6.18.y 1/2] mm/damon/core: allow esz to be set to zero sashiko-bot
2026-09-29 19:13 ` SJ Park
2026-09-30  4:34   ` Greg KH
2026-09-30  8:09     ` SJ Park
2026-09-30 12:29       ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).