From: SJ Park <sj@kernel.org>
To: dayou5941@163.com
Cc: SJ Park <sj@kernel.org>,
akpm@linux-foundation.org, damon@lists.linux.dev,
liyouhong <liyouhong@kylinos.cn>
Subject: Re: [PATCH] mm/damon/core: reject zero sample_interval
Date: Wed, 22 Jul 2026 07:01:13 -0700 [thread overview]
Message-ID: <20260722140113.88379-1-sj@kernel.org> (raw)
In-Reply-To: <20260722094304.3132750-1-dayou5941@163.com>
Hello liyouhong,
Thank you for sharing this patch!
On Wed, 22 Jul 2026 17:43:04 +0800 dayou5941@163.com wrote:
> From: liyouhong <liyouhong@kylinos.cn>
>
> damon_set_attrs() allows sample_interval == 0. Sysfs likewise accepts
> sample_us=0. kdamond_fn() then calls kdamond_usleep(0) every loop
> iteration, so kdamond busy-spins and can peg a CPU.
>
> With a zero sampling interval the access-rate accounting also diverges:
> nr_accesses_bp no longer matches nr_accesses * 10000, and
> kdamond_reset_aggregated() hits:
>
> WARNING: invalid nr_accesses_bp at reset: ...
The warning has removed by nr_accesses_bp optimization patch series, which is
currently queued for 7.3-rc1. So the warning will not be triggered on near
future mainline.
>
> Reject sample_interval == 0 in damon_set_attrs(), which covers sysfs
> commit and other callers. damon_lru_sort already refused a zero
> sample_interval; align the core validation with that.
This is a sort of behavioral change. I also feel this adds another corner case
that makes my head complicated. There are a few logic written under the
assumption of zero intervals. Having inconsistencies between allowed input and
handling logic will make it difficult to maintain in long term. Can't we keep
supporting zero sample interval and fix the warning or the real bug instead?
[1] https://lore.kernel.org/20260630040812.149729-1-sj@kernel.org
Thanks,
SJ
[...]
prev parent reply other threads:[~2026-07-22 14:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-22 9:43 [PATCH] mm/damon/core: reject zero sample_interval dayou5941
2026-07-22 14:01 ` SJ Park [this message]
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=20260722140113.88379-1-sj@kernel.org \
--to=sj@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=damon@lists.linux.dev \
--cc=dayou5941@163.com \
--cc=liyouhong@kylinos.cn \
/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