From: SeongJae Park <sj@kernel.org>
Cc: SeongJae Park <sj@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
damon@lists.linux.dev, kernel-team@meta.com,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: [PATCH 1/8] mm/damon/sysfs-schemes: let damon_sysfs_scheme_set_filters() be used for different named directories
Date: Thu, 20 Feb 2025 11:46:39 -0800 [thread overview]
Message-ID: <20250220194646.37726-2-sj@kernel.org> (raw)
In-Reply-To: <20250220194646.37726-1-sj@kernel.org>
damon_sysfs_scheme_set_filters() is using a hard-coded directory name,
"filters". Refactor for general named directories of same files
hierarchy, to use from upcoming changes.
Signed-off-by: SeongJae Park <sj@kernel.org>
---
mm/damon/sysfs-schemes.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/mm/damon/sysfs-schemes.c b/mm/damon/sysfs-schemes.c
index 66a1c46cee84..541ca5887b24 100644
--- a/mm/damon/sysfs-schemes.c
+++ b/mm/damon/sysfs-schemes.c
@@ -1604,7 +1604,9 @@ static int damon_sysfs_scheme_set_watermarks(struct damon_sysfs_scheme *scheme)
return err;
}
-static int damon_sysfs_scheme_set_filters(struct damon_sysfs_scheme *scheme)
+static int damon_sysfs_scheme_set_filters(struct damon_sysfs_scheme *scheme,
+ const char *name,
+ struct damon_sysfs_scheme_filters **filters_ptr)
{
struct damon_sysfs_scheme_filters *filters =
damon_sysfs_scheme_filters_alloc();
@@ -1614,11 +1616,11 @@ static int damon_sysfs_scheme_set_filters(struct damon_sysfs_scheme *scheme)
return -ENOMEM;
err = kobject_init_and_add(&filters->kobj,
&damon_sysfs_scheme_filters_ktype, &scheme->kobj,
- "filters");
+ name);
if (err)
kobject_put(&filters->kobj);
else
- scheme->filters = filters;
+ *filters_ptr = filters;
return err;
}
@@ -1670,7 +1672,8 @@ static int damon_sysfs_scheme_add_dirs(struct damon_sysfs_scheme *scheme)
err = damon_sysfs_scheme_set_watermarks(scheme);
if (err)
goto put_quotas_access_pattern_out;
- err = damon_sysfs_scheme_set_filters(scheme);
+ err = damon_sysfs_scheme_set_filters(scheme, "filters",
+ &scheme->filters);
if (err)
goto put_watermarks_quotas_access_pattern_out;
err = damon_sysfs_scheme_set_stats(scheme);
--
2.39.5
next prev parent reply other threads:[~2025-02-20 19:46 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` SeongJae Park [this message]
2025-02-20 19:46 ` [PATCH 2/8] mm/damon/sysfs-schemes: implement core_filters and ops_filters directories SeongJae Park
2025-02-20 19:46 ` [PATCH 3/8] mm/damon/sysfs-schemes: commit filters in {core,ops}_filters directories 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
2025-02-20 19:46 ` [PATCH 5/8] mm/damon/sysfs-schemes: set filters handling layer of directories SeongJae Park
2025-02-20 19:46 ` [PATCH 6/8] mm/damon/sysfs-schemes: return error for wrong filter type on given directory SeongJae Park
2025-02-20 19:46 ` [PATCH 7/8] Docs/ABI/damon: document {core,ops}_filters directories SeongJae Park
2025-02-20 19:46 ` [PATCH 8/8] Docs/admin-guide/mm/damon/usage: update for " SeongJae Park
2025-03-05 22:23 ` SeongJae Park
2025-02-20 22:14 ` [PATCH 0/8] mm/damon: add sysfs dirs for managing DAMOS filters based on handling layers SeongJae Park
-- strict thread matches above, loose matches on Subject: below --
2025-03-05 22:27 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
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=20250220194646.37726-2-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox