[PATCH v2 0/2] mm/damon/core: Iterate over installed probes instead of DAMON_MAX_PROBES
From: Suhaas Joshi
Date: Thu Oct 15 2026 - 01:21:36 EST
Hello,
This is v2 of a series [0] I sent earlier. Please find changelog below.
There were two "todo: " items of the same nature in mm/damon/core.c. Both
of these suggested that we should iterate over only installed probes while
updating (last_)probe_hits[] during merging/splitting regions, instead of
iterating over the entire array, which may have empty/unused indices.
So this patch series does exactly that. It replaces the for-loop over
[0, DAMON_MAX_PROBES) with a damon_for_each_probe() over the probe list of
the context.
These patches are based off mm-new. They pass all KUnit tests related to
damon. I have boot tested (but nothing beyond) on qemu-x86_64. Please do
let me know if I should do any specific tests and link the logs here.
Changes v1 -> v2:
1. simplified commit message of patch 1 (on Liew's suggestion)
2. wrapped all lines at 80 characters (on SJ's suggestion)
3. added comments for new argument in function (on SJ's suggestion)
4. added damon_ctx_destroy() in r2 failure case in damon_test_merge_two()
(on SJ/Sashiko/Liew suggestion)
[0] https://lore.kernel.org/damon/20261007154851.45368-1-suhaas@xxxxxxxxxx/
Regards
Suhaas Joshi
Suhaas Joshi (2):
mm/damon/core: Use only installed probe in damon_merge_two_regions()
mm/damon/core: Copy only installed probe in damon_split_region_at()
mm/damon/core.c | 61 ++++++++++++++++++++-------------
mm/damon/tests/core-kunit.h | 68 +++++++++++++++++++++++++++++++------
2 files changed, 95 insertions(+), 34 deletions(-)
base-commit: de3c5f0e6ebc5e0885d99043e071320cbb6ffbde
--
2.55.0