All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "SJ Park" <sj@kernel.org>
Cc: damon@lists.linux.dev
Subject: Re: [RFC PATCH 1/6] mm/damon/tests/core-kunit: test damon_commit_filter()
Date: Wed, 29 Jul 2026 14:52:57 +0000	[thread overview]
Message-ID: <20260729145257.CCFBE1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260729144738.90895-2-sj@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The kunit test uses the wrong enum type `DAMOS_FILTER_TYPE_MEMCG` instead of `DAMON_FILTER_TYPE_MEMCG` when checking `src->type`, causing the `memcg_id` assertion to be silently skipped.
--

--- Patch [1]: [RFC PATCH 1/6] mm/damon/tests/core-kunit: test damon_commit_filter() ---
commit e16ea26a19f85858bdb608d81842e976d30c3270
Author: SJ Park <sj@kernel.org>

mm/damon/tests/core-kunit: test damon_commit_filter()
    
Add kunit test to ensure damon_commit_filter() updates destination
filter as expected for valid inputs.

> diff --git a/mm/damon/tests/core-kunit.h b/mm/damon/tests/core-kunit.h
> index 4a536d41cdb2d..6cbe22accabfb 100644
> --- a/mm/damon/tests/core-kunit.h
> +++ b/mm/damon/tests/core-kunit.h
> @@ -1306,6 +1306,45 @@ static void damon_test_commit_target_regions(struct kunit *test)

[ ... ]

> +static void damon_test_commit_filter_for(struct kunit *test,
> +		struct damon_filter *dst, struct damon_filter *src)
> +{
> +	damon_commit_filter(dst, src);
> +	KUNIT_EXPECT_EQ(test, dst->type, src->type);
> +	KUNIT_EXPECT_EQ(test, dst->matching, src->matching);
> +	KUNIT_EXPECT_EQ(test, dst->allow, src->allow);
> +	switch (src->type) {
> +	case DAMOS_FILTER_TYPE_MEMCG:
> +		KUNIT_EXPECT_EQ(test, dst->memcg_id, src->memcg_id);
> +		break;

[Severity: Medium]
Will this case label ever be matched?

This code checks against DAMOS_FILTER_TYPE_MEMCG, but damon_test_commit_filter()
below initializes the source filter with type DAMON_FILTER_TYPE_MEMCG.

Because of this mismatch, the switch statement falls through to the default
case, and the test silently skips the assertion for memcg_id.

> +	default:
> +		break;
> +	}
> +}
> +
> +static void damon_test_commit_filter(struct kunit *test)
> +{

[ ... ]

> +	damon_test_commit_filter_for(test, &dst,
> +			&(struct damon_filter){
> +			.type = DAMON_FILTER_TYPE_MEMCG,
> +			.matching = false,
> +			.allow = false,
> +			.memcg_id = 123,
> +			});
> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260729144738.90895-1-sj@kernel.org?part=1

  reply	other threads:[~2026-07-29 14:52 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-29 14:47 [RFC PATCH 0/6] mm/damon: add kunit and selftests for probes and probe weights SJ Park
2026-07-29 14:47 ` [RFC PATCH 1/6] mm/damon/tests/core-kunit: test damon_commit_filter() SJ Park
2026-07-29 14:52   ` sashiko-bot [this message]
2026-07-29 14:47 ` [RFC PATCH 2/6] mm/damon/tests/core-kunit: add damon_commit_probes() test SJ Park
2026-07-29 15:00   ` sashiko-bot
2026-07-29 14:47 ` [RFC PATCH 3/6] selftests/damon/_damon_sysfs: implement DamonProbes SJ Park
2026-07-29 15:04   ` sashiko-bot
2026-07-29 14:47 ` [RFC PATCH 4/6] selftests/damon/drgn_dump_damon_status: dump probes SJ Park
2026-07-29 14:47 ` [RFC PATCH 5/6] selftests/damon/sysfs.py: extend commit assertion function for probes SJ Park
2026-07-29 14:47 ` [RFC PATCH 6/6] selftests/damon/sysfs.py: test damon probes SJ Park
2026-07-29 15:19   ` sashiko-bot

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=20260729145257.CCFBE1F000E9@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 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.