[RFC PATCH v2 01/10] mm/damon/core: introduce damos_quota_goal_tuner

From: SeongJae Park

Date: Tue Mar 03 2026 - 23:41:37 EST


Currently DAMOS quota goal feature utilizes a single feedback loop based
algorithm for automatic tuning of the effective quota. It is useful in
dynamic environments that operate systems with only kernels in the long
term. But, no one fits all. It is not very easy to control in
environments having more controlled characteristics and user-space
control towers. We actually got multiple reports [1,2] of use cases
that the algorithm is not optimal.

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
introduces no 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@xxxxxxxxxxxxxx
[2] https://lore.kernel.org/20260204022537.814-1-yunjeong.mun@xxxxxx

Signed-off-by: SeongJae Park <sj@xxxxxxxxxx>
---
include/linux/damon.h | 9 +++++++++
mm/damon/core.c | 2 ++
2 files changed, 11 insertions(+)

diff --git a/include/linux/damon.h b/include/linux/damon.h
index 9a88cf8d152d8..63f1e3fdd3866 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 e8c44541754f7..c5503fdb10bb7 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -432,6 +432,7 @@ struct damos *damon_new_scheme(struct damos_access_pattern *pattern,
scheme->quota = *(damos_quota_init(quota));
/* quota.goals should be separately set by caller */
INIT_LIST_HEAD(&scheme->quota.goals);
+ scheme->quota.goal_tuner = quota->goal_tuner;

scheme->wmarks = *wmarks;
scheme->wmarks.activated = true;
@@ -904,6 +905,7 @@ static int damos_commit_quota(struct damos_quota *dst, struct damos_quota *src)
err = damos_commit_quota_goals(dst, src);
if (err)
return err;
+ dst->goal_tuner = src->goal_tuner;
dst->weight_sz = src->weight_sz;
dst->weight_nr_accesses = src->weight_nr_accesses;
dst->weight_age = src->weight_age;
--
2.47.3