All of lore.kernel.org
 help / color / mirror / Atom feed
From: SeongJae Park <sj@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: SeongJae Park <sj@kernel.org>,
	damon@lists.linux.dev, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH 02/20] mm/damon/sysfs-schemes: implement quota effective_bytes file
Date: Mon, 19 Feb 2024 11:44:13 -0800	[thread overview]
Message-ID: <20240219194431.159606-3-sj@kernel.org> (raw)
In-Reply-To: <20240219194431.159606-1-sj@kernel.org>

DAMON sysfs interface allows users to set two types of quotas, namely
time quota and size quota.  DAMOS converts time quota to a size quota
and use smaller one among the resulting two size quotas.  The resulting
effective size quota can be helpful for debugging and analysis, but not
exposed to the user.  The recently added feedback-driven quota
auto-tuning is making it even more mysterious.

Implement a DAMON sysfs interface read-only empty file, namely
'effective_bytes', under the quota goal DAMON sysfs directory.  It will
be extended to expose the effective quota to the end user.

Signed-off-by: SeongJae Park <sj@kernel.org>
---
 mm/damon/sysfs-schemes.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/mm/damon/sysfs-schemes.c b/mm/damon/sysfs-schemes.c
index f6c7f43f06cc..dd46b2db5455 100644
--- a/mm/damon/sysfs-schemes.c
+++ b/mm/damon/sysfs-schemes.c
@@ -1139,6 +1139,7 @@ struct damon_sysfs_quotas {
 	unsigned long ms;
 	unsigned long sz;
 	unsigned long reset_interval_ms;
+	unsigned long effective_sz;	/* Effective size quota in bytes */
 };
 
 static struct damon_sysfs_quotas *damon_sysfs_quotas_alloc(void)
@@ -1252,6 +1253,15 @@ static ssize_t reset_interval_ms_store(struct kobject *kobj,
 	return count;
 }
 
+static ssize_t effective_bytes_show(struct kobject *kobj,
+		struct kobj_attribute *attr, char *buf)
+{
+	struct damon_sysfs_quotas *quotas = container_of(kobj,
+			struct damon_sysfs_quotas, kobj);
+
+	return sysfs_emit(buf, "%lu\n", quotas->effective_sz);
+}
+
 static void damon_sysfs_quotas_release(struct kobject *kobj)
 {
 	kfree(container_of(kobj, struct damon_sysfs_quotas, kobj));
@@ -1266,10 +1276,14 @@ static struct kobj_attribute damon_sysfs_quotas_sz_attr =
 static struct kobj_attribute damon_sysfs_quotas_reset_interval_ms_attr =
 		__ATTR_RW_MODE(reset_interval_ms, 0600);
 
+static struct kobj_attribute damon_sysfs_quotas_effective_bytes_attr =
+		__ATTR_RO_MODE(effective_bytes, 0400);
+
 static struct attribute *damon_sysfs_quotas_attrs[] = {
 	&damon_sysfs_quotas_ms_attr.attr,
 	&damon_sysfs_quotas_sz_attr.attr,
 	&damon_sysfs_quotas_reset_interval_ms_attr.attr,
+	&damon_sysfs_quotas_effective_bytes_attr.attr,
 	NULL,
 };
 ATTRIBUTE_GROUPS(damon_sysfs_quotas);
-- 
2.39.2


  parent reply	other threads:[~2024-02-19 19:44 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-19 19:44 [PATCH 00/20] mm/damon: let DAMOS feeds and tame/auto-tune itself SeongJae Park
2024-02-19 19:44 ` [PATCH 01/20] mm/damon/core: Set damos_quota->esz as public field and document SeongJae Park
2024-02-19 19:44 ` SeongJae Park [this message]
2024-02-19 19:44 ` [PATCH 03/20] mm/damon/sysfs: implement a kdamond command for updating schemes' effective quotas SeongJae Park
2024-02-19 19:44 ` [PATCH 04/20] Docs/ABI/damon: document effective_bytes sysfs file SeongJae Park
2024-02-19 19:44 ` [PATCH 05/20] Docs/admin-guide/mm/damon/usage: document effective_bytes file SeongJae Park
2024-02-19 19:44 ` [PATCH 06/20] mm/damon: move comments and fields for damos-quota-prioritization to the end SeongJae Park
2024-02-19 19:44 ` [PATCH 07/20] mm/damon/core: split out quota goal related fields to a struct SeongJae Park
2024-02-19 19:44 ` [PATCH 08/20] mm/damon/core: add multiple goals per damos_quota and helpers for those SeongJae Park
2024-02-19 19:44 ` [PATCH 09/20] mm/damon/sysfs: use only quota->goals SeongJae Park
2024-02-19 19:44 ` [PATCH 10/20] mm/damon/core: remove ->goal field of damos_quota SeongJae Park
2024-02-19 19:44 ` [PATCH 11/20] mm/damon/core: let goal specified with only target and current values SeongJae Park
2024-02-19 19:44 ` [PATCH 12/20] mm/damon/core: support multiple metrics for quota goal SeongJae Park
2024-02-19 19:44 ` [PATCH 13/20] mm/damon/core: implement PSI metric DAMOS " SeongJae Park
2024-02-19 19:44 ` [PATCH 14/20] mm/damon/sysfs-schemes: support PSI-based quota auto-tune SeongJae Park
2024-02-19 19:44 ` [PATCH 15/20] Docs/mm/damon/design: document quota goal self-tuning SeongJae Park
2024-02-19 19:44 ` [PATCH 16/20] Docs/ABI/damon: document quota goal metric file SeongJae Park
2024-02-19 19:44 ` [PATCH 17/20] Docs/admin-guide/mm/damon/usage: " SeongJae Park
2024-02-19 19:44 ` [PATCH 18/20] mm/damon/reclaim: implement user-feedback driven quota auto-tuning SeongJae Park
2024-02-19 19:44 ` [PATCH 19/20] mm/damon/reclaim: implement memory PSI-driven quota self-tuning SeongJae Park
2024-02-19 19:44 ` [PATCH 20/20] Docs/admin-guide/mm/damon/reclaim: document auto-tuning parameters 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=20240219194431.159606-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 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.