]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
mm/damon/core: expose damos_filter_for_ops() to DAMON kernel API callers
authorSeongJae Park <sj@kernel.org>
Wed, 5 Mar 2025 22:27:29 +0000 (14:27 -0800)
committerAndrew Morton <akpm@linux-foundation.org>
Tue, 18 Mar 2025 05:06:49 +0000 (22:06 -0700)
damos_filter_for_ops() can be useful to avoid putting wrong type of
filters in wrong place.  Make it be exposed to DAMON kernel API callers.

Link: https://lkml.kernel.org/r/20250305222733.59089-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>
include/linux/damon.h
mm/damon/core.c

index 52559475dbe763266e1a6d33a76a1b93b679193d..eed008b64a23a485de1baa709a3dbf3975067346 100644 (file)
@@ -894,6 +894,7 @@ void damon_update_region_access_rate(struct damon_region *r, bool accessed,
 struct damos_filter *damos_new_filter(enum damos_filter_type type,
                bool matching, bool allow);
 void damos_add_filter(struct damos *s, struct damos_filter *f);
+bool damos_filter_for_ops(enum damos_filter_type type);
 void damos_destroy_filter(struct damos_filter *f);
 
 struct damos_quota_goal *damos_new_quota_goal(
index 511c464adcc527f618d11b4431ab29dacc129422..ebbb228404352874220450b1bb09130ab1d60033 100644 (file)
@@ -281,7 +281,14 @@ struct damos_filter *damos_new_filter(enum damos_filter_type type,
        return filter;
 }
 
-static bool damos_filter_for_ops(enum damos_filter_type type)
+/**
+ * damos_filter_for_ops() - Return if the filter is ops-hndled one.
+ * @type:      type of the filter.
+ *
+ * Return: true if the filter of @type needs to be handled by ops layer, false
+ * otherwise.
+ */
+bool damos_filter_for_ops(enum damos_filter_type type)
 {
        switch (type) {
        case DAMOS_FILTER_TYPE_ADDR: