From: SJ Park <sj@kernel.org>
Cc: SJ Park <sj@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
damon@lists.linux.dev, linux-mm@kvack.org
Subject: [RFC PATCH 1/4] mm/damon/sysfs: define damon_sysfs_cmd_name type and array
Date: Thu, 26 Nov 2026 13:06:14 -0800 [thread overview]
Message-ID: <20261126210619.97634-2-sj@kernel.org> (raw)
In-Reply-To: <20261126210619.97634-1-sj@kernel.org>
Define a new struct for kdamond state file user input handling. The
struct explains what user inputs are for what kdamond commands Define
an array of the structs for all existing inputs.
Signed-off-by: SJ Park <sj@kernel.org>
---
mm/damon/sysfs.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 48 insertions(+)
diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c
index 0049aac6ab974..c76063b703a4a 100644
--- a/mm/damon/sysfs.c
+++ b/mm/damon/sysfs.c
@@ -2254,6 +2254,54 @@ static const char * const damon_sysfs_cmd_strs[] = {
"update_tuned_intervals",
};
+struct damon_sysfs_cmd_name {
+ enum damon_sysfs_cmd cmd;
+ char *name;
+};
+
+static const struct damon_sysfs_cmd_name damon_sysfs_cmd_names[] = {
+ {
+ .cmd = DAMON_SYSFS_CMD_ON,
+ .name = "on",
+ },
+ {
+ .cmd = DAMON_SYSFS_CMD_OFF,
+ .name = "off",
+ },
+ {
+ .cmd = DAMON_SYSFS_CMD_COMMIT,
+ .name = "commit",
+ },
+ {
+ .cmd = DAMON_SYSFS_CMD_COMMIT_SCHEMES_QUOTA_GOALS,
+ .name = "commit_schemes_quota_goals",
+ },
+ {
+ .cmd = DAMON_SYSFS_CMD_UPDATE_SCHEMES_STATS,
+ .name = "update_schemes_stats",
+ },
+ {
+ .cmd = DAMON_SYSFS_CMD_UPDATE_SCHEMES_TRIED_BYTES,
+ .name = "update_schemes_tried_bytes",
+ },
+ {
+ .cmd = DAMON_SYSFS_CMD_UPDATE_SCHEMES_TRIED_REGIONS,
+ .name = "update_schemes_tried_regions",
+ },
+ {
+ .cmd = DAMON_SYSFS_CMD_CLEAR_SCHEMES_TRIED_REGIONS,
+ .name = "clear_schemes_tried_regions",
+ },
+ {
+ .cmd = DAMON_SYSFS_CMD_UPDATE_SCHEMES_EFFECTIVE_QUOTAS,
+ .name = "update_schemes_effective_quotas",
+ },
+ {
+ .cmd = DAMON_SYSFS_CMD_UPDATE_TUNED_INTERVALS,
+ .name = "update_tuned_intervals",
+ },
+};
+
static ssize_t state_show(struct kobject *kobj, struct kobj_attribute *attr,
char *buf)
{
--
2.47.3
next prev parent reply other threads:[~2026-11-26 21:06 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-26 21:06 [RFC PATCH 0/4] mm/damon/sysfs: refactor state input matching SJ Park
2026-11-26 21:06 ` SJ Park [this message]
2026-11-26 21:06 ` [RFC PATCH 2/4] mm/damon/sysfs: use damon_sysfs_cmd_names in state_store() SJ Park
2026-11-26 21:06 ` [RFC PATCH 3/4] mm/damon/sysfs: use damon_sysfs_cmd_names in state_show() SJ Park
2026-11-26 21:06 ` [RFC PATCH 4/4] mm/damon/sysfs: remove damon_sysfs_cmd_strs SJ Park
2026-11-26 21:12 ` [RFC PATCH 0/4] mm/damon/sysfs: refactor state input matching sashiko-bot
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=20261126210619.97634-2-sj@kernel.org \
--to=sj@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=damon@lists.linux.dev \
--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