mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-31 12:52:29 -04:00
mm/damon/core: get merge threshold from probe hits when weights are set
When probe weights are set, DAMON merges regions based on their probe hits weighted sum. But the merge threshold is calculated based on the access frequency. Update it to retrieve the maximum probe hits weighted sum in the snapshot from apply_probes() ops callback, and generate the threshold based on it. Link: https://lore.kernel.org/20260710134651.18084-15-sj@kernel.org Signed-off-by: SJ Park <sj@kernel.org> Cc: David Hildenbrand <david@kernel.org> Cc: Jonathan Corbet <corbet@lwn.net> Cc: Liam R. Howlett <liam@infradead.org> Cc: Lorenzo Stoakes <ljs@kernel.org> Cc: Michal Hocko <mhocko@suse.com> Cc: Mike Rapoport <rppt@kernel.org> Cc: Suren Baghdasaryan <surenb@google.com> Cc: Vlastimil Babka <vbabka@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
@@ -3763,7 +3763,8 @@ 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;
|
||||
unsigned int max_merge_score = 0, max_wsum;
|
||||
bool get_max_wsum;
|
||||
|
||||
if (kdamond_wait_activation(ctx))
|
||||
break;
|
||||
@@ -3776,9 +3777,18 @@ static int kdamond_fn(void *data)
|
||||
|
||||
if (!access_check_disabled && ctx->ops.check_accesses)
|
||||
max_merge_score = ctx->ops.check_accesses(ctx);
|
||||
if (ctx->ops.apply_probes)
|
||||
ctx->ops.apply_probes(ctx, access_check_disabled,
|
||||
false);
|
||||
if (ctx->ops.apply_probes) {
|
||||
if (time_after_eq(ctx->passed_sample_intervals,
|
||||
next_aggregation_sis) &&
|
||||
access_check_disabled)
|
||||
get_max_wsum = true;
|
||||
else
|
||||
get_max_wsum = false;
|
||||
max_wsum = ctx->ops.apply_probes(ctx,
|
||||
access_check_disabled, get_max_wsum);
|
||||
if (get_max_wsum)
|
||||
max_merge_score = max_wsum;
|
||||
}
|
||||
|
||||
if (time_after_eq(ctx->passed_sample_intervals,
|
||||
next_aggregation_sis)) {
|
||||
|
||||
Reference in New Issue
Block a user