[RFC PATCH v1.2 01/12] mm/damon/core: use damon_nr_samples_per_aggr() for max merge threshold
SJ Park <[email protected]> Wed, 29 Jul 2026 07:02:41 -0700
| Newsgroups | dev.linux.lists.damon,org.kernel.vger.linux-kernel,org.kvack.linux-mm |
|---|---|
| Message-ID | <[email protected]> |
kdamond_merge_regions() open-codes max region merge threshold calculation. What it does is fundamentally the same as damon_nr_samples_per_aggr() but missing a few corner cases. The unhandled corner cases should be rare and make only a negligible level of monitoring results degradation. But having the inconsistency could increase future maintenance burden. Use the dedicated function. Signed-off-by: SJ Park <[email protected]> --- mm/damon/core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mm/damon/core.c b/mm/damon/core.c index f7c9b94b6436b..4169268d94416 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -3470,8 +3470,7 @@ static void kdamond_merge_regions(struct damon_ctx *c, unsigned int threshold, unsigned int max_thres; bool count_age = true; - max_thres = c->attrs.aggr_interval / - (c->attrs.sample_interval ? c->attrs.sample_interval : 1); + max_thres = damon_nr_samples_per_aggr(&c->attrs); while (true) { nr_regions = 0; damon_for_each_target(t, c) { -- 2.47.3