summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeongJae Park <sj@kernel.org>2025-07-12 12:50:05 -0700
committerAndrew Morton <akpm@linux-foundation.org>2025-07-19 18:59:54 -0700
commit405f61996d9d2e9d497cd9f6b66f41dc28d3d1d8 (patch)
tree0f9c0f750655015e56db531939df49fe2c859ff8
parent43df7676e5508895c33b846d37cff9cf3b52674c (diff)
mm/damon/stat: use damon_call() repeat mode instead of damon_callback
DAMON_STAT uses damon_callback for periodically reading DAMON internal data. Use its alternative, damon_call() repeat mode. Link: https://lkml.kernel.org/r/20250712195016.151108-4-sj@kernel.org Signed-off-by: SeongJae Park <sj@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
-rw-r--r--mm/damon/stat.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/mm/damon/stat.c b/mm/damon/stat.c
index b75af871627e..87bcd8866d4b 100644
--- a/mm/damon/stat.c
+++ b/mm/damon/stat.c
@@ -122,8 +122,9 @@ static void damon_stat_set_idletime_percentiles(struct damon_ctx *c)
kfree(sorted_regions);
}
-static int damon_stat_after_aggregation(struct damon_ctx *c)
+static int damon_stat_damon_call_fn(void *data)
{
+ struct damon_ctx *c = data;
static unsigned long last_refresh_jiffies;
/* avoid unnecessarily frequent stat update */
@@ -182,19 +183,29 @@ static struct damon_ctx *damon_stat_build_ctx(void)
damon_add_target(ctx, target);
if (damon_set_region_biggest_system_ram_default(target, &start, &end))
goto free_out;
- ctx->callback.after_aggregation = damon_stat_after_aggregation;
return ctx;
free_out:
damon_destroy_ctx(ctx);
return NULL;
}
+static struct damon_call_control call_control = {
+ .fn = damon_stat_damon_call_fn,
+ .repeat = true,
+};
+
static int damon_stat_start(void)
{
+ int err;
+
damon_stat_context = damon_stat_build_ctx();
if (!damon_stat_context)
return -ENOMEM;
- return damon_start(&damon_stat_context, 1, true);
+ err = damon_start(&damon_stat_context, 1, true);
+ if (err)
+ return err;
+ call_control.data = damon_stat_context;
+ return damon_call(damon_stat_context, &call_control);
}
static void damon_stat_stop(void)