From: SeongJae Park <sj@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: SeongJae Park <sj@kernel.org>,
damon@lists.linux.dev, linux-kernel@vger.kernel.org,
linux-mm@kvack.org
Subject: [PATCH 02/10] mm/damon/core: add damos_filter->pass field
Date: Tue, 7 Jan 2025 12:17:31 -0800 [thread overview]
Message-ID: <20250107201739.79484-3-sj@kernel.org> (raw)
In-Reply-To: <20250107201739.79484-1-sj@kernel.org>
DAMOS filters work as only exclusive (block) filters. This makes it
easy to be confused, and restrictive at combining multiple filters for
various types of memory.
Add a field anmed 'pass' to damos_filter. The field will be used to
indicate whether the filter should work for inclusion or not.
Following two commits will make the core and operations set layer,
which handles the damos_filter object, respect the field, respectively.
Signed-off-by: SeongJae Park <sj@kernel.org>
---
include/linux/damon.h | 4 +++-
mm/damon/core.c | 1 +
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/include/linux/damon.h b/include/linux/damon.h
index 72afba74ac6d..baeb884ed156 100644
--- a/include/linux/damon.h
+++ b/include/linux/damon.h
@@ -348,7 +348,8 @@ enum damos_filter_type {
/**
* struct damos_filter - DAMOS action target memory filter.
* @type: Type of the target memory.
- * @matching: If the @type-matching memory should be filtered out.
+ * @matching: Whether this is for @type-matching memory.
+ * @pass: Whether the memory should pass-through the filter.
* @memcg_id: Memcg id of the question if @type is DAMOS_FILTER_MEMCG.
* @addr_range: Address range if @type is DAMOS_FILTER_TYPE_ADDR.
* @target_idx: Index of the &struct damon_target of
@@ -365,6 +366,7 @@ enum damos_filter_type {
struct damos_filter {
enum damos_filter_type type;
bool matching;
+ bool pass;
union {
unsigned short memcg_id;
struct damon_addr_range addr_range;
diff --git a/mm/damon/core.c b/mm/damon/core.c
index 52e50f183ffe..e54bd19d6f06 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -275,6 +275,7 @@ struct damos_filter *damos_new_filter(enum damos_filter_type type,
return NULL;
filter->type = type;
filter->matching = matching;
+ filter->pass = false;
INIT_LIST_HEAD(&filter->list);
return filter;
}
--
2.39.5
next prev parent reply other threads:[~2025-01-07 20:18 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-07 20:17 [PATCH 00/10] mm/damon: extend DAMOS filters for inclusion SeongJae Park
2025-01-07 20:17 ` [PATCH 01/10] mm/damon: fixup damos_filter kernel-doc SeongJae Park
2025-01-07 20:17 ` SeongJae Park [this message]
2025-01-07 20:17 ` [PATCH 03/10] mm/damon/core: support damos_filter->pass SeongJae Park
2025-01-07 20:17 ` [PATCH 04/10] mm/damon/paddr: " SeongJae Park
2025-01-07 20:17 ` [PATCH 05/10] mm/damon: add pass argument to damos_new_filter() SeongJae Park
2025-01-07 20:17 ` [PATCH 06/10] mm/damon/sysfs-schemes: add a file for setting damos_filter->pass SeongJae Park
2025-01-07 20:17 ` [PATCH 07/10] Docs/mm/damon/design: document pass/block filters behaviors SeongJae Park
2025-01-08 4:04 ` SeongJae Park
2025-01-08 17:26 ` SeongJae Park
2025-01-07 20:17 ` [PATCH 08/10] Docs/ABI/damon: document DAMOS filter pass sysfs file SeongJae Park
2025-01-07 20:17 ` [PATCH 09/10] Docs/admin-guide/mm/damon/usage: omit DAMOS filter details in favor of design doc SeongJae Park
2025-01-07 20:17 ` [PATCH 10/10] Docs/admin-guide/mm/damon/usage: document DAMOS filter 'pass' sysfs file SeongJae Park
2025-01-08 4:09 ` [PATCH 00/10] mm/damon: extend DAMOS filters for inclusion 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=20250107201739.79484-3-sj@kernel.org \
--to=sj@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=damon@lists.linux.dev \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox