From: SJ Park <sj@kernel.org>
Cc: SJ Park <sj@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
damon@lists.linux.dev, linux-kernel@vger.kernel.org,
linux-mm@kvack.org
Subject: [RFC PATCH 3/7] mm/damon/sysfs-schemes: support quota goal complement flag
Date: Fri, 18 Sep 2026 07:28:22 -0700 [thread overview]
Message-ID: <20260918142827.85303-4-sj@kernel.org> (raw)
In-Reply-To: <20260918142827.85303-1-sj@kernel.org>
Add a new sysfs file, complement, under the quota goal directory. It
works for setting and getting the quota goal metric complement flag
value.
Signed-off-by: SJ Park <sj@kernel.org>
---
mm/damon/sysfs-schemes.c | 32 +++++++++++++++++++++++++++++++-
1 file changed, 31 insertions(+), 1 deletion(-)
diff --git a/mm/damon/sysfs-schemes.c b/mm/damon/sysfs-schemes.c
index 06af417bc9a2f..8f083611741fd 100644
--- a/mm/damon/sysfs-schemes.c
+++ b/mm/damon/sysfs-schemes.c
@@ -1220,6 +1220,7 @@ static const struct kobj_type damon_sysfs_watermarks_ktype = {
struct damos_sysfs_quota_goal {
struct kobject kobj;
enum damos_quota_goal_metric metric;
+ bool complement;
unsigned long target_value;
unsigned long current_value;
int nid;
@@ -1316,6 +1317,30 @@ static ssize_t target_metric_store(struct kobject *kobj,
return -EINVAL;
}
+static ssize_t complement_show(struct kobject *kobj,
+ struct kobj_attribute *attr, char *buf)
+{
+ struct damos_sysfs_quota_goal *goal = container_of(kobj,
+ struct damos_sysfs_quota_goal, kobj);
+
+ return sysfs_emit(buf, "%c\n", goal->complement ? 'Y' : 'N');
+}
+
+static ssize_t complement_store(struct kobject *kobj,
+ struct kobj_attribute *attr, const char *buf, size_t count)
+{
+ struct damos_sysfs_quota_goal *goal = container_of(kobj,
+ struct damos_sysfs_quota_goal, kobj);
+ bool complement;
+ int err = kstrtobool(buf, &complement);
+
+ if (err)
+ return err;
+
+ goal->complement = complement;
+ return count;
+}
+
static ssize_t target_value_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{
@@ -1424,6 +1449,9 @@ static void damos_sysfs_quota_goal_release(struct kobject *kobj)
static struct kobj_attribute damos_sysfs_quota_goal_target_metric_attr =
__ATTR_RW_MODE(target_metric, 0600);
+static struct kobj_attribute damos_sysfs_quota_goal_complement_attr =
+ __ATTR_RW_MODE(complement, 0600);
+
static struct kobj_attribute damos_sysfs_quota_goal_target_value_attr =
__ATTR_RW_MODE(target_value, 0600);
@@ -1438,6 +1466,7 @@ static struct kobj_attribute damos_sysfs_quota_goal_path_attr =
static struct attribute *damos_sysfs_quota_goal_attrs[] = {
&damos_sysfs_quota_goal_target_metric_attr.attr,
+ &damos_sysfs_quota_goal_complement_attr.attr,
&damos_sysfs_quota_goal_target_value_attr.attr,
&damos_sysfs_quota_goal_current_value_attr.attr,
&damos_sysfs_quota_goal_nid_attr.attr,
@@ -2869,7 +2898,8 @@ static int damos_sysfs_add_quota_score(
if (!sysfs_goal->target_value)
continue;
- goal = damos_new_quota_goal(sysfs_goal->metric, false,
+ goal = damos_new_quota_goal(sysfs_goal->metric,
+ sysfs_goal->complement,
sysfs_goal->target_value);
if (!goal)
return -ENOMEM;
--
2.47.3
next prev parent reply other threads:[~2026-09-18 14:28 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-18 14:28 [RFC PATCH 0/7] mm/damon: introduce damos quota goal target metric complement flag SJ Park
2026-09-18 14:28 ` [RFC PATCH 1/7] mm/damon/core: introduce damos_quota_goal->complement SJ Park
2026-09-18 14:48 ` sashiko-bot
2026-09-18 15:08 ` SJ Park
2026-09-18 14:28 ` [RFC PATCH 2/7] mm/damon: add complement argument to damos_new_quota_goal() SJ Park
2026-09-18 14:56 ` sashiko-bot
2026-09-18 14:28 ` SJ Park [this message]
2026-09-18 15:05 ` [RFC PATCH 3/7] mm/damon/sysfs-schemes: support quota goal complement flag sashiko-bot
2026-09-18 15:09 ` SJ Park
2026-09-18 14:28 ` [RFC PATCH 4/7] mm/damon/tests/core-kunit: test quota_goal->complement commit SJ Park
2026-09-18 15:07 ` sashiko-bot
2026-09-18 14:28 ` [RFC PATCH 5/7] Docs/mm/damon/design: document damos quota goal complement flag SJ Park
2026-09-18 15:07 ` sashiko-bot
2026-09-18 14:28 ` [RFC PATCH 6/7] Docs/admin-guide/mm/damon/usage: update for quota goal complement file SJ Park
2026-09-18 15:09 ` sashiko-bot
2026-09-18 15:11 ` SJ Park
2026-09-18 14:28 ` [RFC PATCH 7/7] Docs/ABI/damon: update for quota goal metric complement sysfs file SJ Park
2026-09-18 15:21 ` 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=20260918142827.85303-4-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 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.