mirror of https://github.com/torvalds/linux.git
samples/damon/wsse: use damon_call() repeat mode instead of damon_callback
wsse uses damon_callback for periodically reading DAMON internal data. Use its alternative, damon_call() repeat mode. Link: https://lkml.kernel.org/r/20250712195016.151108-8-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
a6c33f1054
commit
cc9c1b8c20
|
|
@ -35,8 +35,9 @@ MODULE_PARM_DESC(enabled, "Enable or disable DAMON_SAMPLE_WSSE");
|
|||
static struct damon_ctx *ctx;
|
||||
static struct pid *target_pidp;
|
||||
|
||||
static int damon_sample_wsse_after_aggregate(struct damon_ctx *c)
|
||||
static int damon_sample_wsse_repeat_call_fn(void *data)
|
||||
{
|
||||
struct damon_ctx *c = data;
|
||||
struct damon_target *t;
|
||||
|
||||
damon_for_each_target(t, c) {
|
||||
|
|
@ -52,9 +53,15 @@ static int damon_sample_wsse_after_aggregate(struct damon_ctx *c)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static struct damon_call_control repeat_call_control = {
|
||||
.fn = damon_sample_wsse_repeat_call_fn,
|
||||
.repeat = true,
|
||||
};
|
||||
|
||||
static int damon_sample_wsse_start(void)
|
||||
{
|
||||
struct damon_target *target;
|
||||
int err;
|
||||
|
||||
pr_info("start\n");
|
||||
|
||||
|
|
@ -79,8 +86,11 @@ static int damon_sample_wsse_start(void)
|
|||
}
|
||||
target->pid = target_pidp;
|
||||
|
||||
ctx->callback.after_aggregation = damon_sample_wsse_after_aggregate;
|
||||
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_wsse_stop(void)
|
||||
|
|
|
|||
Loading…
Reference in New Issue