@@ -56,6 +56,10 @@ struct damon_ctx {
struct rnd_state rndseed;
struct list_head tasks_list; /* 'damon_task' objects */
+
+ /* callbacks */
+ void (*sample_cb)(struct damon_ctx *context);
+ void (*aggregate_cb)(struct damon_ctx *context);
};
int damon_set_pids(struct damon_ctx *ctx, unsigned long *pids, ssize_t nr_pids);
@@ -787,9 +787,13 @@ static int kdamond_fn(void *data)
}
mmput(mm);
}
+ if (ctx->sample_cb)
+ ctx->sample_cb(ctx);
if (kdamond_aggregate_interval_passed(ctx)) {
kdamond_merge_regions(ctx, max_nr_accesses / 10);
+ if (ctx->aggregate_cb)
+ ctx->aggregate_cb(ctx);
kdamond_reset_aggregated(ctx);
kdamond_split_regions(ctx);
}