aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
authorSeongJae Park <sj@kernel.org>2026-05-18 16:41:02 -0700
committerAndrew Morton <akpm@linux-foundation.org>2026-05-28 21:31:13 -0700
commit0487ebf74a5d8a3a724896b294697f4bafbf00cc (patch)
tree629599db46320556c656676327af0abb6f0a5d72 /mm
parent6745dcaf27be1badc349d60117e02c7c77d554ef (diff)
downloadlinux-next-history-0487ebf74a5d8a3a724896b294697f4bafbf00cc.tar.gz
mm/damon/sysfs: setup probes on DAMON core API parameters
Add user-installed data probes to DAMON core API parameters, so that user inputs for data probes are passed to DAMON core. Link: https://lore.kernel.org/20260518234119.97569-15-sj@kernel.org Signed-off-by: SeongJae 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: "Masami Hiramatsu (Google)" <mhiramat@kernel.org> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Cc: Michal Hocko <mhocko@suse.com> Cc: Mike Rapoport <rppt@kernel.org> Cc: Shuah Khan <shuah@kernel.org> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Suren Baghdasaryan <surenb@google.com> Cc: Vlastimil Babka <vbabka@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/damon/sysfs.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c
index 51a4f05c9275c..eeb7fdd030cf0 100644
--- a/mm/damon/sysfs.c
+++ b/mm/damon/sysfs.c
@@ -1855,6 +1855,40 @@ static int damon_sysfs_set_attrs(struct damon_ctx *ctx,
return damon_set_attrs(ctx, &attrs);
}
+static int damon_sysfs_set_probes(struct damon_ctx *ctx,
+ struct damon_sysfs_probes *sys_probes)
+{
+ int i;
+
+ for (i = 0; i < sys_probes->nr; i++) {
+ struct damon_sysfs_filters *sys_filters =
+ sys_probes->probes_arr[i]->filters;
+ struct damon_probe *c;
+ int j;
+
+ if (!sys_filters)
+ continue;
+ c = damon_new_probe();
+ if (!c)
+ return -ENOMEM;
+ damon_add_probe(ctx, c);
+
+ for (j = 0; j < sys_filters->nr; j++) {
+ struct damon_sysfs_filter *sys_filter =
+ sys_filters->filters_arr[j];
+ struct damon_filter *filter;
+
+ filter = damon_new_filter(sys_filter->type,
+ sys_filter->matching,
+ sys_filter->allow);
+ if (!filter)
+ return -ENOMEM;
+ damon_add_filter(c, filter);
+ }
+ }
+ return 0;
+}
+
static int damon_sysfs_set_regions(struct damon_target *t,
struct damon_sysfs_regions *sysfs_regions,
unsigned long min_region_sz)
@@ -1969,6 +2003,9 @@ static int damon_sysfs_apply_inputs(struct damon_ctx *ctx,
err = damon_sysfs_set_attrs(ctx, sys_ctx->attrs);
if (err)
return err;
+ err = damon_sysfs_set_probes(ctx, sys_ctx->attrs->probes);
+ if (err)
+ return err;
err = damon_sysfs_add_targets(ctx, sys_ctx->targets);
if (err)
return err;