From: SJ Park <sj@kernel.org>
Cc: SJ Park <sj@kernel.org>,
stable@vger.kernel.org, Andrew Morton <akpm@linux-foundation.org>,
damon@lists.linux.dev, linux-mm@kvack.org
Subject: [RFC PATCH mm-hotfixes-unstable] mm/damon/core: do not update stat for core filter rejecting region
Date: Fri, 27 Nov 2026 12:39:37 -0800 [thread overview]
Message-ID: <20261127203938.94339-1-sj@kernel.org> (raw)
damos_apply_scheme() update stats for regions that were unable to apply
the scheme due to the quota. Those are counted as tried and failed. It
doesn't update stats for regions that were rejected by DAMOS core
filters. Those are counted as not tried at all.
However, the DAMOS quota-driven failure is handled before DAMOS core
filters. Regions that would be rejected by the core filter can, hence,
be accounted as tried and failed. As a result, users could show
confusing stat changes.
Fix by handling core filters before quotas.
The user impact is not critical. No crash or leak happens. Only the
DAMOS stat could occasionally move in an unexpected way.
Fixes: ab9bda001b68 ("mm/damon/core: introduce address range type damos filter")
Cc: <stable@vger.kernel.org> # 6.6.x
closes: https://sashiko.dev/#/bug/linux-9c51890e-a25c-4534-afab-ef33f22a9557
Signed-off-by: SJ Park <sj@kernel.org>
---
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 0e6b361f97ea..e0ea93de100d 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -2785,6 +2785,8 @@ static void damos_apply_scheme(struct damon_ctx *c, struct damon_target *t,
}
if (c->ops.apply_scheme) {
+ if (damos_core_filter_out(c, t, r, s))
+ return;
if (damos_quota_is_set(quota) &&
quota->charged_sz + sz > quota->esz) {
sz = ALIGN_DOWN(quota->esz - quota->charged_sz,
@@ -2794,8 +2796,6 @@ static void damos_apply_scheme(struct damon_ctx *c, struct damon_target *t,
if (damon_split_region_at(t, r, sz))
goto update_stat;
}
- if (damos_core_filter_out(c, t, r, s))
- return;
sz = damon_sz_region(r);
ktime_get_coarse_ts64(&begin);
trace_damos_before_apply(cidx, sidx, tidx, r, nr_accesses,
base-commit: daba53bdc1a54c453c2f4ced54a1cd52416c3f87
--
2.47.3
reply other threads:[~2026-11-27 20:39 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261127203938.94339-1-sj@kernel.org \
--to=sj@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=damon@lists.linux.dev \
--cc=linux-mm@kvack.org \
--cc=stable@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox