]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
mm/damon/core: remove damon_verify_nr_regions()
authorSeongJae Park <sj@kernel.org>
Fri, 22 May 2026 15:40:20 +0000 (08:40 -0700)
committerAndrew Morton <akpm@linux-foundation.org>
Thu, 4 Jun 2026 21:45:01 +0000 (14:45 -0700)
commitb8db646fe9a77845c37680ca416847ced5763c06
treef8c4da21399274caef109c75084bb24500bf8497
parent8f793f1ad5bd9f4f7e9c4fa734a7995ef2a2401f
mm/damon/core: remove damon_verify_nr_regions()

When CONFIG_DAMON_DEBUG_SANITY is enabled, damon_verify_nr_regions() is
called for each damon_nr_regions() invocation.  damon_veify_nr_regions()
iterates all regions.  damon_nr_regions() is called for each region in
kdamond_reset_aggregated() and damos_apply_scheme().  Hence it imposes
O(n**2) overhead where n is the number of regions.

Though the verification is enabled only under DAMON_DEBUG_SANITY, which is
not for production use cases, it could be too high overhead.  Meanwhile,
damon_verify_ctx() is doing the damon_nr_regions() test.  Because
damon_verify_ctx() is called for each kdamond_call(), the test coverage
from damon_verify_ctx() could be sufficient.  Remove damon_nr_regions()
verification.

Link: https://lore.kernel.org/20260522154026.80546-10-sj@kernel.org
Signed-off-by: SeongJae Park <sj@kernel.org>
Cc: Brendan Higgins <brendan.higgins@linux.dev>
Cc: Shuah Khan <shuah@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/damon/core.c