From: SeongJae Park <sj@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: SeongJae Park <sj@kernel.org>,
damon@lists.linux.dev, kernel-team@meta.com,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: [PATCH 4/8] mm/damon/core: expose damos_filter_for_ops() to DAMON kernel API callers
Date: Wed, 5 Mar 2025 14:27:29 -0800 [thread overview]
Message-ID: <20250305222733.59089-5-sj@kernel.org> (raw)
In-Reply-To: <20250305222733.59089-1-sj@kernel.org>
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.
Signed-off-by: SeongJae Park <sj@kernel.org>
---
include/linux/damon.h | 1 +
mm/damon/core.c | 9 ++++++++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/include/linux/damon.h b/include/linux/damon.h
index 52559475dbe7..eed008b64a23 100644
--- a/include/linux/damon.h
+++ b/include/linux/damon.h
@@ -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(
diff --git a/mm/damon/core.c b/mm/damon/core.c
index 194550e033b1..d4fc2c907cfc 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -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:
--
2.39.5
next prev parent reply other threads:[~2025-03-05 22:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-05 22:27 [PATCH 0/8] mm/damon: add sysfs dirs for managing DAMOS filters based on handling layers SeongJae Park
2025-03-05 22:27 ` [PATCH 1/8] mm/damon/sysfs-schemes: let damon_sysfs_scheme_set_filters() be used for different named directories SeongJae Park
2025-03-05 22:27 ` [PATCH 2/8] mm/damon/sysfs-schemes: implement core_filters and ops_filters directories SeongJae Park
2025-03-05 22:27 ` [PATCH 3/8] mm/damon/sysfs-schemes: commit filters in {core,ops}_filters directories SeongJae Park
2025-03-05 22:27 ` SeongJae Park [this message]
2025-03-05 22:27 ` [PATCH 5/8] mm/damon/sysfs-schemes: record filters of which layer should be added to the given filters directory SeongJae Park
2025-03-05 22:27 ` [PATCH 6/8] mm/damon/sysfs-schemes: return error when for attempts to install filters on wrong sysfs directory SeongJae Park
2025-03-05 22:27 ` [PATCH 7/8] Docs/ABI/damon: document {core,ops}_filters directories SeongJae Park
2025-03-05 22:27 ` [PATCH 8/8] Docs/admin-guide/mm/damon/usage: update for " SeongJae Park
-- strict thread matches above, loose matches on Subject: below --
2025-02-20 19:46 [PATCH 0/8] mm/damon: add sysfs dirs for managing DAMOS filters based on handling layers SeongJae Park
2025-02-20 19:46 ` [PATCH 4/8] mm/damon/core: expose damos_filter_for_ops() to DAMON kernel API callers SeongJae Park
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250305222733.59089-5-sj@kernel.org \
--to=sj@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=damon@lists.linux.dev \
--cc=kernel-team@meta.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.