From: SeongJae Park <sj@kernel.org>
To: SeongJae Park <sj@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
damon@lists.linux.dev, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, Ravi Jonnalagadda <ravis.opensrc@gmail.com>
Subject: Re: [RFC PATCH 1/5] mm/damon/core: introduce damos_quota_goal_tuner
Date: Thu, 26 Feb 2026 17:56:13 -0800 [thread overview]
Message-ID: <20260227015613.91346-1-sj@kernel.org> (raw)
In-Reply-To: <20260212062314.69961-2-sj@kernel.org>
On Wed, 11 Feb 2026 22:23:08 -0800 SeongJae Park <sj@kernel.org> wrote:
> Currently DAMOS quota goal feature utilizes a single feedback loop based
> algorithm for automatic tuning of the effective quota. It is proven to
> be useful on dynamic environments that operate systems with only
> kernels. But, no one fits all, and we got multiple reports [1,2] of
> cases that the algorithm is not optimum.
>
> Introduce a new field of 'struct damos_quotas', namely 'goal_tuner'. It
> specifies what tuning algorithm the given scheme should use, and allows
> DAMON API callers to set it as they want. Nonetheless, this commit does
> not introduce a new tuning algorithm but only the interface. This
> commit hence makes no behavioral change. A new algorithm will be added
> by the following commit.
>
> [1] https://lore.kernel.org/CALa+Y17__d=ZsM1yX+MXx0ozVdsXnFqF4p0g+kATEitrWyZFfg@mail.gmail.com
> [2] https://lore.kernel.org/20260204022537.814-1-yunjeong.mun@sk.com
>
> Signed-off-by: SeongJae Park <sj@kernel.org>
> ---
> include/linux/damon.h | 9 +++++++++
> mm/damon/core.c | 4 +++-
> 2 files changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/include/linux/damon.h b/include/linux/damon.h
> index a4fea23da8576..25345b5f821b9 100644
> --- a/include/linux/damon.h
> +++ b/include/linux/damon.h
> @@ -213,6 +213,14 @@ struct damos_quota_goal {
> struct list_head list;
> };
>
> +/**
> + * enum damos_quota_goal_tuner - Goal-based quota tuning logic.
> + * @DAMOS_QUOTA_GOAL_TUNER_CONSIST: Aim long term consistent quota.
> + */
> +enum damos_quota_goal_tuner {
> + DAMOS_QUOTA_GOAL_TUNER_CONSIST,
> +};
> +
> /**
> * struct damos_quota - Controls the aggressiveness of the given scheme.
> * @reset_interval: Charge reset interval in milliseconds.
> @@ -260,6 +268,7 @@ struct damos_quota {
> unsigned long ms;
> unsigned long sz;
> struct list_head goals;
> + enum damos_quota_goal_tuner goal_tuner;
> unsigned long esz;
>
> unsigned int weight_sz;
> diff --git a/mm/damon/core.c b/mm/damon/core.c
> index 0ff190ed8a599..1c126d910fe62 100644
> --- a/mm/damon/core.c
> +++ b/mm/damon/core.c
> @@ -405,8 +405,9 @@ struct damos *damon_new_scheme(struct damos_access_pattern *pattern,
> INIT_LIST_HEAD(&scheme->list);
>
> scheme->quota = *(damos_quota_init(quota));
> - /* quota.goals should be separately set by caller */
> + /* quota.goals and .goal_tuner should be separately set by caller */
> INIT_LIST_HEAD(&scheme->quota.goals);
> + scheme->quota.goal_tuner = DAMOS_QUOTA_GOAL_TUNER_CONSIST;
Ravi found this is resetting tuner setup in damon_sysfs_add_quota_score() in
sysfs-schemes.c. As a result, users were unable to use goal_tuner feature.
Ravi further suggested a fix that sets the goal_tuner after damon_new_scheme(),
as suggested here.
I was thinking that's the right fix assuming the comment is right. I was also
thinking I entirely forgot setting the goal_tuner field in sysfs-schemes.c.
But I now find I didn't entirely forget it, as the third patch of this series
does set it on the quota struct that is passed to damon_new_scheme(). However
I was stupidly forgetting the fact that damon_new_scheme() overwrites the
field, and I asked callers to set it after the call.
Now I think the above initialization and the instruction on the comment is just
wrong. There is no reason to refuse the caller-set value in the parameter
struct. Rather, it only confuses callers.
I will fix the issue by simply dropping the above diff.
[1] https://lore.kernel.org/20260223123232.12851-2-ravis.opensrc@gmail.com
Thanks,
SJ
[...]
next prev parent reply other threads:[~2026-02-27 1:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-12 6:23 [RFC PATCH 0/5] mm/damon: support multiple goal-based quota tuning algorithms SeongJae Park
2026-02-12 6:23 ` [RFC PATCH 1/5] mm/damon/core: introduce damos_quota_goal_tuner SeongJae Park
2026-02-27 1:56 ` SeongJae Park [this message]
2026-02-12 6:23 ` [RFC PATCH 2/5] mm/damon/core: introduce DAMOS_QUOTA_GOAL_TUNER_TEMPORAL SeongJae Park
2026-02-12 6:23 ` [RFC PATCH 3/5] mm/damon/sysfs-schemes: implement quotas->goal_tuner file SeongJae Park
2026-02-12 6:23 ` [RFC PATCH 4/5] Docs/mm/damon/design: document the goal-based quota tuner selections SeongJae Park
2026-02-12 6:23 ` [RFC PATCH 5/5] Docs/admin-guide/mm/damon/usage: document goal_tuner sysfs file 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=20260227015613.91346-1-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 \
--cc=ravis.opensrc@gmail.com \
/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