mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 12:44:03 +02:00
samples/damon/prcl: use damon_call() repeat mode instead of damon_callback
prcl uses damon_callback for periodically reading DAMON internal data. Use its alternative, damon_call() repeat mode. Link: https://lkml.kernel.org/r/20250712195016.151108-7-sj@kernel.org Signed-off-by: SeongJae Park <sj@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
9cc8f00e52
commit
a6c33f1054
|
|
@ -34,8 +34,9 @@ MODULE_PARM_DESC(enabled, "Enable or disable DAMON_SAMPLE_PRCL");
|
||||||
static struct damon_ctx *ctx;
|
static struct damon_ctx *ctx;
|
||||||
static struct pid *target_pidp;
|
static struct pid *target_pidp;
|
||||||
|
|
||||||
static int damon_sample_prcl_after_aggregate(struct damon_ctx *c)
|
static int damon_sample_prcl_repeat_call_fn(void *data)
|
||||||
{
|
{
|
||||||
|
struct damon_ctx *c = data;
|
||||||
struct damon_target *t;
|
struct damon_target *t;
|
||||||
|
|
||||||
damon_for_each_target(t, c) {
|
damon_for_each_target(t, c) {
|
||||||
|
|
@ -51,10 +52,16 @@ static int damon_sample_prcl_after_aggregate(struct damon_ctx *c)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static struct damon_call_control repeat_call_control = {
|
||||||
|
.fn = damon_sample_prcl_repeat_call_fn,
|
||||||
|
.repeat = true,
|
||||||
|
};
|
||||||
|
|
||||||
static int damon_sample_prcl_start(void)
|
static int damon_sample_prcl_start(void)
|
||||||
{
|
{
|
||||||
struct damon_target *target;
|
struct damon_target *target;
|
||||||
struct damos *scheme;
|
struct damos *scheme;
|
||||||
|
int err;
|
||||||
|
|
||||||
pr_info("start\n");
|
pr_info("start\n");
|
||||||
|
|
||||||
|
|
@ -79,8 +86,6 @@ static int damon_sample_prcl_start(void)
|
||||||
}
|
}
|
||||||
target->pid = target_pidp;
|
target->pid = target_pidp;
|
||||||
|
|
||||||
ctx->callback.after_aggregation = damon_sample_prcl_after_aggregate;
|
|
||||||
|
|
||||||
scheme = damon_new_scheme(
|
scheme = damon_new_scheme(
|
||||||
&(struct damos_access_pattern) {
|
&(struct damos_access_pattern) {
|
||||||
.min_sz_region = PAGE_SIZE,
|
.min_sz_region = PAGE_SIZE,
|
||||||
|
|
@ -100,7 +105,12 @@ static int damon_sample_prcl_start(void)
|
||||||
}
|
}
|
||||||
damon_set_schemes(ctx, &scheme, 1);
|
damon_set_schemes(ctx, &scheme, 1);
|
||||||
|
|
||||||
return damon_start(&ctx, 1, true);
|
err = damon_start(&ctx, 1, true);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
|
||||||
|
repeat_call_control.data = ctx;
|
||||||
|
return damon_call(ctx, &repeat_call_control);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void damon_sample_prcl_stop(void)
|
static void damon_sample_prcl_stop(void)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user