DAMON development mailing list
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Suhaas Joshi" <suhaas@s-joshi.in>
Cc: damon@lists.linux.dev
Subject: Re: [PATCH v3 1/2] mm/damon/core: Use only installed probe in damon_merge_two_regions()
Date: Mon, 12 Oct 2026 15:14:52 +0000	[thread overview]
Message-ID: <sashiko-outbox-168320@kernel.org> (raw)
In-Reply-To: <20261012150045.169377-1-suhaas@s-joshi.in>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] mm/damon: memory leak of test resources on damon_new_probe() failure
--

commit 04d02846ea56f0db196cf44b60e21ab0f25afe04
Author: Suhaas Joshi <suhaas@s-joshi.in>

mm/damon/core: Use only installed probe in damon_merge_two_regions()

This commit optimizes region merging by iterating only over installed
probes rather than the entire maximum probe array. It also introduces
a struct damon_ctx parameter to damon_merge_two_regions() and updates
tests to pass this new argument.

> diff --git a/mm/damon/tests/core-kunit.h b/mm/damon/tests/core-kunit.h
> index 3fbb4e4e36fac..385d32901650e 100644
> --- a/mm/damon/tests/core-kunit.h
> +++ b/mm/damon/tests/core-kunit.h
[ ... ]
> @@ -206,7 +208,21 @@ static void damon_test_merge_two(struct kunit *test)
>  	r2->age = 21;
>  	damon_add_region(r2, t);
>  
> -	damon_merge_two_regions(t, r, r2);
> +	p = damon_new_probe();
> +	if (!p) {
> +		kunit_skip(test, "probe alloc fail");
> +		damon_free_target(t);
> +	}

[Severity: Low]
Does this code leak the allocated target t and its regions on probe
allocation failure?

Since kunit_skip() invokes kunit_try_catch_throw() which halts the test
case execution immediately, the code does not return from this macro.
This means the subsequent damon_free_target(t) call is unreachable dead
code.

Should the cleanup be performed before calling kunit_skip(), similar to
how it is handled in the subsequent context allocation failure block?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261012145636.168436-1-suhaas@s-joshi.in?part=1

  reply	other threads:[~2026-10-12 15:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-12 14:56 [PATCH v3 0/2] mm/damon/core: Iterate over installed probes instead of DAMON_MAX_PROBES Suhaas Joshi
2026-10-12 15:00 ` [PATCH v3 1/2] mm/damon/core: Use only installed probe in damon_merge_two_regions() Suhaas Joshi
2026-10-12 15:14   ` sashiko-bot [this message]
2026-10-12 19:28   ` SJ Park
2026-10-12 15:00 ` [PATCH v3 2/2] mm/damon/core: Copy only installed probe in damon_split_region_at() Suhaas Joshi
2026-10-12 15:14   ` sashiko-bot
2026-10-12 19:39   ` 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=sashiko-outbox-168320@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=damon@lists.linux.dev \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=suhaas@s-joshi.in \
    /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