From: sashiko-bot@kernel.org
To: "Liew Rui Yan" <aethernet65535@gmail.com>
Cc: damon@lists.linux.dev
Subject: Re: [PATCH 2/2] mm/damon: skip deactivated schemes in watermark checks and add fallback sleep
Date: Fri, 07 Aug 2026 09:47:31 +0000 [thread overview]
Message-ID: <20260807094731.9122F1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260807093526.183009-3-aethernet65535@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] kdamond_wait_activation() traps kdamond in an infinite sleep loop when no schemes are registered, completely breaking pure access monitoring.
--
--- Patch [2]: [PATCH 2/2] mm/damon: skip deactivated schemes in watermark checks and add fallback sleep ---
commit 7f4aa250c9a91aca4f1a7a02df1c14e1ab990d4e
Author: Liew Rui Yan <aethernet65535@gmail.com>
mm/damon: skip deactivated schemes in watermark checks and add fallback sleep
This commit modifies scheme evaluation to skip those deactivated either by
watermarks or max_nr_snapshots. It also changes kdamond_wait_activation()
to sleep for the sample interval as a fallback when all schemes are
deactivated.
> diff --git a/mm/damon/core.c b/mm/damon/core.c
> --- a/mm/damon/core.c
> +++ b/mm/damon/core.c
[ ... ]
> @@ -3704,16 +3711,23 @@ static int kdamond_wait_activation(struct damon_ctx *ctx)
>
> while (!kdamond_need_stop(ctx)) {
> damon_for_each_scheme(s, ctx) {
> + if (s->max_nr_snapshots &&
> + s->max_nr_snapshots <= s->stat.nr_snapshots)
> + continue;
> +
> wait_time = damos_wmark_wait_us(s);
> if (!init_wait_time || wait_time < min_wait_time) {
> init_wait_time = true;
> min_wait_time = wait_time;
> }
> }
> - if (!min_wait_time)
> + if (!min_wait_time && init_wait_time)
> return 0;
>
> - kdamond_usleep(min_wait_time);
> + if (min_wait_time)
> + kdamond_usleep(min_wait_time);
> + else
> + kdamond_usleep(ctx->attrs.sample_interval);
[Severity: High]
Does this change cause a regression where kdamond becomes trapped in an
infinite sleep loop if no schemes are configured?
When a user starts DAMON for pure access monitoring without configuring any
schemes, the damon_for_each_scheme() loop is bypassed. This leaves
init_wait_time as false.
Because init_wait_time is false, the condition
if (!min_wait_time && init_wait_time) will fail. The function then falls
through to the new fallback logic:
kdamond_usleep(ctx->attrs.sample_interval);
Since init_wait_time remains false on every iteration of the while loop,
kdamond_wait_activation() will never return 0. Could this permanently hang
the monitoring thread and prevent it from collecting any access metrics?
>
> kdamond_call(ctx, false);
> if (ctx->maybe_corrupted)
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260807093526.183009-1-aethernet65535@gmail.com?part=2
next prev parent reply other threads:[~2026-08-07 9:47 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-07 9:35 [RFC PATCH 0/2] mm/damon: fix nr_snapshots semantics and max_nr_snapshots check coverage Liew Rui Yan
2026-08-07 9:35 ` [PATCH 1/2] mm/damon: fix nr_snapshots counting using tried_applied flag Liew Rui Yan
2026-08-07 9:48 ` sashiko-bot
2026-08-07 13:52 ` SJ Park
2026-08-07 9:35 ` [PATCH 2/2] mm/damon: skip deactivated schemes in watermark checks and add fallback sleep Liew Rui Yan
2026-08-07 9:47 ` sashiko-bot [this message]
2026-08-07 14:07 ` SJ Park
2026-08-07 16:18 ` Liew Rui Yan
2026-08-08 0:07 ` SJ Park
2026-08-08 21:55 ` Liew Rui Yan
2026-08-08 22:50 ` SJ Park
2026-08-07 14:12 ` [RFC PATCH 0/2] mm/damon: fix nr_snapshots semantics and max_nr_snapshots check coverage SJ Park
2026-08-07 16:19 ` Liew Rui Yan
2026-08-07 23:59 ` SJ 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=20260807094731.9122F1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=aethernet65535@gmail.com \
--cc=damon@lists.linux.dev \
--cc=sashiko-reviews@lists.linux.dev \
/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