aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorSeongJae Park <sj@kernel.org>2025-03-04 13:19:08 -0800
committerAndrew Morton <akpm@linux-foundation.org>2025-03-17 00:05:38 -0700
commit2a689e4e83bdc90cd00ca21aa28d337d202f4950 (patch)
treedd2872578acf137ee48cf01719110b19f8cf2c7c
parentmm/damon/core: support committing ops_filters (diff)
downloadwireguard-linux-2a689e4e83bdc90cd00ca21aa28d337d202f4950.tar.xz
wireguard-linux-2a689e4e83bdc90cd00ca21aa28d337d202f4950.zip
mm/damon/core: put ops-handled filters to damos->ops_filters
damos->ops_filters has introduced to be used for all operations layer handled filters. But DAMON kernel API callers can put any type of DAMOS filters to any of damos->filters and damos->ops_filters. DAMON user-space ABI users have no way to use ->ops_filters at all. Update damos_add_filter(), which should be used by API callers to install DAMOS filters, to add filters to ->filters and ->ops_filters depending on their handling layer. The change forces both API callers and ABI users to use proper lists since ABI users use the API internally. Link: https://lkml.kernel.org/r/20250304211913.53574-5-sj@kernel.org Signed-off-by: SeongJae Park <sj@kernel.org> Cc: Jonathan Corbet <corbet@lwn.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
-rw-r--r--mm/damon/core.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/mm/damon/core.c b/mm/damon/core.c
index 1daccccb5d67..3fbc31d17239 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -281,9 +281,24 @@ struct damos_filter *damos_new_filter(enum damos_filter_type type,
return filter;
}
+static bool damos_filter_for_ops(enum damos_filter_type type)
+{
+ switch (type) {
+ case DAMOS_FILTER_TYPE_ADDR:
+ case DAMOS_FILTER_TYPE_TARGET:
+ return false;
+ default:
+ break;
+ }
+ return true;
+}
+
void damos_add_filter(struct damos *s, struct damos_filter *f)
{
- list_add_tail(&f->list, &s->filters);
+ if (damos_filter_for_ops(f->type))
+ list_add_tail(&f->list, &s->ops_filters);
+ else
+ list_add_tail(&f->list, &s->filters);
}
static void damos_del_filter(struct damos_filter *f)