diff options
| author | SeongJae Park <sj@kernel.org> | 2026-05-19 02:41:14 +0300 |
|---|---|---|
| committer | Andrew Morton <akpm@linux-foundation.org> | 2026-06-03 01:22:31 +0300 |
| commit | 543ab01db7ace5bb28972ac70f321d55cc4f0214 (patch) | |
| tree | 3dc5d95287bdf2599cbd7e8bb7bbacaaa16dd536 | |
| parent | b2025ce0662b186b3158c25f7f9c25b4e6931acc (diff) | |
| download | linux-543ab01db7ace5bb28972ac70f321d55cc4f0214.tar.xz | |
mm/damon/sysfs: setup damon_filter->memcg_id from path
Find and set the memcg_id for damon_filter from the user-passed memory
cgroup path when updating the DAMON input parameters.
Link: https://lore.kernel.org/20260518234119.97569-27-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>
| -rw-r--r-- | include/linux/damon.h | 1 | ||||
| -rw-r--r-- | mm/damon/core.c | 2 | ||||
| -rw-r--r-- | mm/damon/sysfs.c | 11 |
3 files changed, 13 insertions, 1 deletions
diff --git a/include/linux/damon.h b/include/linux/damon.h index 6a54c601889b..4014fd0d463c 100644 --- a/include/linux/damon.h +++ b/include/linux/damon.h @@ -1006,6 +1006,7 @@ static inline unsigned long damon_sz_region(struct damon_region *r) struct damon_filter *damon_new_filter(enum damon_filter_type type, bool matching, bool allow); void damon_add_filter(struct damon_probe *probe, struct damon_filter *f); +void damon_destroy_filter(struct damon_filter *f); struct damon_probe *damon_new_probe(void); void damon_add_probe(struct damon_ctx *ctx, struct damon_probe *probe); diff --git a/mm/damon/core.c b/mm/damon/core.c index 9a5a835a4d3f..4e223857a0f9 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -143,7 +143,7 @@ static void damon_free_filter(struct damon_filter *f) kfree(f); } -static void damon_destroy_filter(struct damon_filter *f) +void damon_destroy_filter(struct damon_filter *f) { damon_del_filter(f); damon_free_filter(f); diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c index 0f6379caf481..2e95e3bac774 100644 --- a/mm/damon/sysfs.c +++ b/mm/damon/sysfs.c @@ -1927,6 +1927,17 @@ static int damon_sysfs_set_probes(struct damon_ctx *ctx, sys_filter->allow); if (!filter) return -ENOMEM; + if (filter->type == DAMON_FILTER_TYPE_MEMCG) { + int err; + + err = damon_sysfs_memcg_path_to_id( + sys_filter->path, + &filter->memcg_id); + if (err) { + damon_destroy_filter(filter); + return err; + } + } damon_add_filter(c, filter); } } |
