Re: [PATCH v3 1/2] mm/damon/core: Use only installed probe in damon_merge_two_regions()
From: SJ Park
Date: Mon Oct 12 2026 - 15:28:53 EST
On Mon, 12 Oct 2026 20:30:39 +0530 Suhaas Joshi <suhaas@xxxxxxxxxx> wrote:
> While merging 2 regions, we iterate over the entire probe_hits[] array,
> whose size is determined by the DAMON_MAX_PROBES macro. However, it is
> possible that we have fewer probes installed than DAMON_MAX_PROBES. In such
> cases, we end up making redundant iterations. Therefore, to remedy this,
> iterate over the list of installed probes instead of iterating over the
> entire array. For doing this, start accepting a struct damon_ctx in
> damon_merge_two_regions(), and update calling functions to pass this
> argument.
>
> Update the damon_test_merge_two() test to use this new signature for
> damon_merge_two_regions() as well.
[...]
> diff --git 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);
> + }
As Sashiko also asked [1], shouldn't kunit_skip() be called after
damon_free_target()?
[1] https://lore.kernel.org/sashiko-outbox-168320@xxxxxxxxxx
Thanks,
SJ
[...]