From b9bc678bfb6bfdad9b2dcdc4bce33018f81c33ac Mon Sep 17 00:00:00 2001 From: SJ Park Date: Fri, 10 Jul 2026 06:46:42 -0700 Subject: mm/damon/core: s/max_nr_accesses/max_merge_score/ in kdamond_fn() When probe weights are set, DAMON merge logic works with the probe hits weighted sum. The core logic is setting the merge threshold based on the access frequency, though. Before using probe hits based threshold, rename the variables to look more general. Link: https://lore.kernel.org/20260710134651.18084-14-sj@kernel.org Signed-off-by: SJ Park Cc: David Hildenbrand Cc: Jonathan Corbet Cc: Liam R. Howlett Cc: Lorenzo Stoakes Cc: Michal Hocko Cc: Mike Rapoport Cc: Suren Baghdasaryan Cc: Vlastimil Babka Signed-off-by: Andrew Morton --- mm/damon/core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/damon/core.c b/mm/damon/core.c index dd0612e1a408..f7782c69037d 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -3730,7 +3730,6 @@ static void kdamond_init_ctx(struct damon_ctx *ctx) static int kdamond_fn(void *data) { struct damon_ctx *ctx = data; - unsigned int max_nr_accesses = 0; unsigned long sz_limit = 0; pr_debug("kdamond (%d) starts\n", current->pid); @@ -3764,6 +3763,7 @@ static int kdamond_fn(void *data) unsigned long next_ops_update_sis = ctx->next_ops_update_sis; unsigned long sample_interval = ctx->attrs.sample_interval; bool access_check_disabled = damon_has_probe_weights(ctx); + unsigned int max_merge_score = 0; if (kdamond_wait_activation(ctx)) break; @@ -3775,7 +3775,7 @@ static int kdamond_fn(void *data) ctx->passed_sample_intervals++; if (!access_check_disabled && ctx->ops.check_accesses) - max_nr_accesses = ctx->ops.check_accesses(ctx); + max_merge_score = ctx->ops.check_accesses(ctx); if (ctx->ops.apply_probes) ctx->ops.apply_probes(ctx, access_check_disabled, false); @@ -3783,7 +3783,7 @@ static int kdamond_fn(void *data) if (time_after_eq(ctx->passed_sample_intervals, next_aggregation_sis)) { kdamond_merge_regions(ctx, - max_nr_accesses / 10, + max_merge_score / 10, sz_limit); /* online updates might be made */ sz_limit = damon_apply_min_nr_regions(ctx); -- cgit v1.2.3