DAMON development mailing list
 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 v2 2/7] mm/damon: add complement argument to damos_new_quota_goal()
Date: Sat, 19 Sep 2026 01:23:27 +0000	[thread overview]
Message-ID: <20260919012327.DA7141F00898@smtp.kernel.org> (raw)
In-Reply-To: <20260919011359.88921-3-sj@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] mm: damon: hardcoded false complement flag when cloning quota goals
--

commit 9116ea6f94ac9ade4ef359ba8351ef835957bf80
Author: SJ Park <sj@kernel.org>

mm/damon: add complement argument to damos_new_quota_goal()

This commit extends the damos_new_quota_goal() constructor to accept and
set the 'complement' flag value. It also updates all API callers to use
the new signature, which aims to prevent mistakes where the complement
flag was previously set manually.

> diff --git a/mm/damon/core.c b/mm/damon/core.c
> index 9fd08cbfacd8c..932ca3ad0e593 100644
> --- a/mm/damon/core.c
> +++ b/mm/damon/core.c
> @@ -1262,8 +1263,8 @@ int damos_commit_quota_goals(struct damos_quota *dst, struct damos_quota *src)
>  	damos_for_each_quota_goal_safe(src_goal, next, src) {
>  		if (j++ < i)
>  			continue;
> -		new_goal = damos_new_quota_goal(
> -				src_goal->metric, src_goal->target_value);
> +		new_goal = damos_new_quota_goal(src_goal->metric, false,
> +				src_goal->target_value);

[Severity: Low]
Does this code discard the 'complement' flag from 'src_goal'?

By hardcoding 'false' here instead of passing 'src_goal->complement', the
copied goal initially loses its complement state. While it appears
damos_commit_quota_goal() immediately overwrites the flag with the correct
value, passing 'false' defeats the purpose of the explicit constructor
argument and could create a brittle pattern.

>  		if (!new_goal)
>  			return -ENOMEM;
>  		err = damos_commit_quota_goal(new_goal, src_goal);

[ ... ]

> diff --git a/mm/damon/tests/core-kunit.h b/mm/damon/tests/core-kunit.h
> index 5ff0436c58441..bba97ad449110 100644
> --- a/mm/damon/tests/core-kunit.h
> +++ b/mm/damon/tests/core-kunit.h
> @@ -929,7 +929,7 @@ static void damos_test_commit_quota_goals_for(struct kunit *test,
>  		 * damos_commit_quota_goals() will kfree() the dst goals.
>  		 * Make it kfree()-able.
>  		 */
> -		goal = damos_new_quota_goal(dst_goals[i].metric,
> +		goal = damos_new_quota_goal(dst_goals[i].metric, false,
>  				dst_goals[i].target_value);

[Severity: Low]
Does this discard the 'complement' flag from 'dst_goals[i]'?

Hardcoding 'false' instead of passing 'dst_goals[i].complement' might
break future tests that attempt to verify complemented goals, as the
destination goals in the test framework will lose their intended complement
state.

>  		if (!goal)
>  			goto out;

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

  reply	other threads:[~2026-09-19  1:23 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-19  1:13 [RFC PATCH v2 0/7] mm/damon: introduce damos quota goal target metric complement flag SJ Park
2026-09-19  1:13 ` [RFC PATCH v2 1/7] mm/damon/core: introduce damos_quota_goal->complement SJ Park
2026-09-19  1:25   ` sashiko-bot
2026-09-19  1:27     ` SJ Park
2026-09-19  1:13 ` [RFC PATCH v2 2/7] mm/damon: add complement argument to damos_new_quota_goal() SJ Park
2026-09-19  1:23   ` sashiko-bot [this message]
2026-09-19  1:36     ` SJ Park
2026-09-19  1:13 ` [RFC PATCH v2 3/7] mm/damon/sysfs-schemes: support quota goal complement flag SJ Park
2026-09-19  1:26   ` sashiko-bot
2026-09-19  1:37     ` SJ Park
2026-09-19  1:13 ` [RFC PATCH v2 4/7] mm/damon/tests/core-kunit: test quota_goal->complement commit SJ Park
2026-09-19  1:17   ` sashiko-bot
2026-09-19  1:13 ` [RFC PATCH v2 5/7] Docs/mm/damon/design: document damos quota goal complement flag SJ Park
2026-09-19  1:16   ` sashiko-bot
2026-09-19  1:13 ` [RFC PATCH v2 6/7] Docs/admin-guide/mm/damon/usage: update for quota goal complement file SJ Park
2026-09-19  1:16   ` sashiko-bot
2026-09-19  1:13 ` [RFC PATCH v2 7/7] Docs/ABI/damon: update for quota goal metric complement sysfs file SJ Park
2026-09-19  1:23   ` sashiko-bot
2026-09-19  1:38     ` 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=20260919012327.DA7141F00898@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