From: Ravi Jonnalagadda <ravis.opensrc@gmail.com>
To: sj@kernel.org, damon@lists.linux.dev, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org
Cc: akpm@linux-foundation.org, corbet@lwn.net, bijan311@gmail.com,
ajayjoshi@micron.com, honggyu.kim@sk.com, yunjeong.mun@sk.com,
Ravi Jonnalagadda <ravis.opensrc@gmail.com>
Subject: [RFC PATCH v3 2/4] mm/damon: fix esz=0 quota bypass allowing unlimited migration
Date: Mon, 23 Feb 2026 12:32:30 +0000 [thread overview]
Message-ID: <20260223123232.12851-3-ravis.opensrc@gmail.com> (raw)
In-Reply-To: <20260223123232.12851-1-ravis.opensrc@gmail.com>
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@gmail.com>
---
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
next prev parent reply other threads:[~2026-02-23 12:40 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-23 12:32 [RFC PATCH v3 0/4] mm/damon: Introduce node_eligible_mem_bp and node_ineligible_mem_bp Quota Goal Metrics Ravi Jonnalagadda
2026-02-23 12:32 ` [RFC PATCH v3 1/4] mm/damon/sysfs: set goal_tuner after scheme creation Ravi Jonnalagadda
2026-02-24 1:40 ` SeongJae Park
2026-02-25 18:23 ` Ravi Jonnalagadda
2026-02-26 0:53 ` SeongJae Park
2026-02-27 2:04 ` SeongJae Park
2026-02-23 12:32 ` Ravi Jonnalagadda [this message]
2026-02-24 1:54 ` [RFC PATCH v3 2/4] mm/damon: fix esz=0 quota bypass allowing unlimited migration SeongJae Park
2026-02-25 18:28 ` Ravi Jonnalagadda
2026-02-26 0:54 ` SeongJae Park
2026-02-23 12:32 ` [RFC PATCH v3 3/4] mm/damon: add node_eligible_mem_bp and node_ineligible_mem_bp goal metrics Ravi Jonnalagadda
2026-02-24 4:27 ` SeongJae Park
2026-02-25 18:46 ` Ravi Jonnalagadda
2026-02-26 0:57 ` SeongJae Park
2026-02-23 12:32 ` [RFC PATCH v4 4/4] mm/damon: add PA-mode cache for eligible memory detection lag Ravi Jonnalagadda
2026-02-24 5:54 ` SeongJae Park
2026-02-25 18:58 ` Ravi Jonnalagadda
2026-02-26 0:59 ` SeongJae Park
2026-02-24 5:36 ` [RFC PATCH v3 0/4] mm/damon: Introduce node_eligible_mem_bp and node_ineligible_mem_bp Quota Goal Metrics SeongJae Park
2026-02-25 18:19 ` Ravi Jonnalagadda
2026-02-26 0:52 ` SeongJae Park
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260223123232.12851-3-ravis.opensrc@gmail.com \
--to=ravis.opensrc@gmail.com \
--cc=ajayjoshi@micron.com \
--cc=akpm@linux-foundation.org \
--cc=bijan311@gmail.com \
--cc=corbet@lwn.net \
--cc=damon@lists.linux.dev \
--cc=honggyu.kim@sk.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=sj@kernel.org \
--cc=yunjeong.mun@sk.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.