From: sashiko-bot@kernel.org
To: "SJ Park" <sj@kernel.org>
Cc: damon@lists.linux.dev
Subject: Re: [RFC PATCH v1.2 1/7] mm/damon/core: remove comment and test for nr_to_bp() divide-by-zero
Date: Wed, 08 Jul 2026 01:43:18 +0000 [thread overview]
Message-ID: <20260708014318.CC7DF1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260708013252.95888-2-sj@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The commit message claims to entirely remove the test code, but instead leaves a broken, orphaned test function causing build failures.
--
--- Patch [1]: [RFC PATCH v1.2 1/7] mm/damon/core: remove comment and test for nr_to_bp() divide-by-zero ---
commit d67544b646a2eb5eb3336e5b2555a05dd0f2f18c
Author: SJ Park <sj@kernel.org>
mm/damon/core: remove comment and test for nr_to_bp() divide-by-zero
This patch removes obsolete comments and test code related to division by zero
in DAMON's nr_accesses_to_accesses_bp() function, noting that earlier commits
prevent zero aggregation intervals from reaching this code.
> Commit 35d4a3cf70a8 ("mm/damon/ops-common: handle extreme
> intervals in damon_hot_score()") modified damon_nr_samples_per_aggr() to
> always return non-zero. Hence no division-by-zero of the note can
> happen. Remove the obsolete comment on the function. The test code was
> written to test the division-by-zero case, which cannot happen anymore.
> Having it makes no sense. Entirely remove the test code and its
> comment.
[Severity: Medium]
The commit message states that the test code was entirely removed, but the
diff shows the test being rewritten to damon_test_max_nr_accesses() instead.
Also, should the commit message reference damon_max_nr_accesses() here
instead of damon_nr_samples_per_aggr(), given the function that is actually
being tested in the diff?
> diff --git a/mm/damon/tests/core-kunit.h b/mm/damon/tests/core-kunit.h
> index 0124f83b39b83..b2a280556b841 100644
> --- a/mm/damon/tests/core-kunit.h
> +++ b/mm/damon/tests/core-kunit.h
> @@ -575,26 +575,20 @@ static void damon_test_set_regions(struct kunit *test)
> }, 3);
> }
>
> -static void damon_test_nr_accesses_to_accesses_bp(struct kunit *test)
> +static void damon_test_max_nr_accesses(struct kunit *test)
> {
> struct damon_attrs attrs = {
> - .sample_interval = 10,
> - .aggr_interval = ((unsigned long)UINT_MAX + 1) * 10
> + .sample_interval = 0,
> + .aggr_interval = 0,
> };
[ ... ]
> + /* Zero aggregation interval doesn't cause division by zero */
> - KUNIT_EXPECT_EQ(test, damon_nr_accesses_to_accesses_bp(123, &attrs), 0);
> + KUNIT_EXPECT_EQ(test, damon_max_nr_accesses(attrs), 1);
[Severity: Medium]
Will this cause a build failure?
Looking at damon_max_nr_accesses(), it expects a pointer to struct damon_attrs
rather than a struct passed by value. Passing attrs here directly looks like it
will result in an incompatible type error during compilation.
[ ... ]
> @@ -1572,7 +1566,6 @@ static struct kunit_case damon_test_cases[] = {
> KUNIT_CASE(damon_test_split_above_half_progresses),
> KUNIT_CASE(damon_test_ops_registration),
> KUNIT_CASE(damon_test_set_regions),
> - KUNIT_CASE(damon_test_nr_accesses_to_accesses_bp),
> KUNIT_CASE(damon_test_update_monitoring_result),
> KUNIT_CASE(damon_test_set_attrs),
> KUNIT_CASE(damon_test_mvsum),
[Severity: Medium]
Does removing this test case from the array orphan the newly rewritten test
function above?
Since damon_test_max_nr_accesses() is declared as static and is no longer
referenced by damon_test_cases[], it appears this will trigger a
-Wunused-function warning when compiling the tests.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260708013252.95888-1-sj@kernel.org?part=1
next prev parent reply other threads:[~2026-07-08 1:43 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-08 1:32 [RFC PATCH v1.2 0/7] mm/damon: update probe hits for runtime parameter commits SJ Park
2026-07-08 1:32 ` [RFC PATCH v1.2 1/7] mm/damon/core: remove comment and test for nr_to_bp() divide-by-zero SJ Park
2026-07-08 1:43 ` sashiko-bot [this message]
2026-07-08 1:32 ` [RFC PATCH v1.2 2/7] mm/damon/core: s/damon_max_nr_accesses()/damon_nr_samples_per_aggr()/ SJ Park
2026-07-08 1:45 ` sashiko-bot
2026-07-08 1:32 ` [RFC PATCH v1.2 3/7] mm/damon/core: s/accesses_bp_to_nr_accesses/sample_bp_to_count/ SJ Park
2026-07-08 1:42 ` sashiko-bot
2026-07-08 1:32 ` [RFC PATCH v1.2 4/7] mm/damon/core: s/nr_accesses_to_accesses_bp/sample_count_to_bp/ SJ Park
2026-07-08 1:48 ` sashiko-bot
2026-07-08 1:32 ` [RFC PATCH v1.2 5/7] mm/damon/core: s/nr_accesses_for_new_attrs/nr_samples_for_new_attrs/ SJ Park
2026-07-08 1:45 ` sashiko-bot
2026-07-08 1:32 ` [RFC PATCH v1.2 6/7] mm/damon/core: update probe hits for new parameter commit SJ Park
2026-07-08 1:47 ` sashiko-bot
2026-07-08 1:32 ` [RFC PATCH v1.2 7/7] mm/damon/core: handle unreset probe_hits in probe_hits_mvsum() SJ Park
2026-07-08 2:32 ` [RFC PATCH v1.2 0/7] mm/damon: update probe hits for runtime parameter commits 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=20260708014318.CC7DF1F00A3A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=damon@lists.linux.dev \
--cc=sashiko-reviews@lists.linux.dev \
--cc=sj@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