From: sashiko-bot@kernel.org
To: "Karthikeyan KS" <karthiproffesional@gmail.com>
Cc: damon@lists.linux.dev
Subject: Re: [PATCH] mm/damon: reject zero sampling interval
Date: Thu, 17 Sep 2026 15:21:02 +0000 [thread overview]
Message-ID: <20260917152102.99CF71F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260917150631.1138698-1-karthiproffesional@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] mm: obsolete zero-interval fallbacks left in core.c
--
commit 3fc9c7e0ec1f59dfad336e3842553089ded8b3b8
Author: Karthikeyan KS <karthiproffesional@gmail.com>
mm/damon: reject zero sampling interval
damon_set_attrs() already rejects inverted intervals, but it accepts
sample_interval == 0. A zero sampling interval is not a valid monitoring
period and causes busy-spinning in kdamond. Return -EINVAL if
sample_interval is zero.
> diff --git a/mm/damon/core.c b/mm/damon/core.c
> index 444c97c184027..7faa92106cf1d 100644
> --- a/mm/damon/core.c
> +++ b/mm/damon/core.c
> @@ -1135,6 +1135,8 @@ int damon_set_attrs(struct damon_ctx *ctx, struct damon_attrs *attrs)
> return -EINVAL;
> if (attrs->min_nr_regions > attrs->max_nr_regions)
> return -EINVAL;
> + if (!attrs->sample_interval)
> + return -EINVAL;
[Severity: Low]
Since attrs->sample_interval and attrs->aggr_interval are now explicitly
rejected if zero, do we still need the zero-interval fallbacks scattered
throughout core.c?
For example, earlier in damon_set_attrs() we have:
unsigned long sample_interval = attrs->sample_interval ?
attrs->sample_interval : 1;
And similarly in kdamond_init_ctx() and kdamond_fn():
sample_interval = ctx->attrs.sample_interval ?
ctx->attrs.sample_interval : 1;
There is also a defensive check in damon_update_monitoring_results() that
looks obsolete now:
if (!old_attrs->sample_interval || !old_attrs->aggr_interval ||
!new_attrs->sample_interval ||
!new_attrs->aggr_interval)
return;
Should we clean up these zero-interval fallbacks since they appear to be
structurally unreachable after this change?
> if (attrs->sample_interval > attrs->aggr_interval)
> return -EINVAL;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260917150631.1138698-1-karthiproffesional@gmail.com?part=1
next prev parent reply other threads:[~2026-09-17 15:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-17 15:06 [PATCH] mm/damon: reject zero sampling interval Karthikeyan KS
2026-09-17 15:21 ` sashiko-bot [this message]
2026-09-17 16:09 ` Sang-Heon Jeon
2026-09-17 18:00 ` Karthikeyan KS
2026-09-18 2:38 ` SeongJae Park
2026-09-18 13:13 ` [PATCH v2] mm/damon: document that a zero sample_interval is accepted Karthikeyan KS
2026-09-18 13:17 ` sashiko-bot
2026-09-18 13:35 ` SJ Park
2026-09-18 17:07 ` Karthikeyan KS
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=20260917152102.99CF71F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=damon@lists.linux.dev \
--cc=karthiproffesional@gmail.com \
--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 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.