From nobody Thu Apr 9 09:25:49 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5F55B22332E; Wed, 4 Mar 2026 04:41:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772599288; cv=none; b=iNIn+G0YabNaBHwWUvd0OhTskj899pJFBWyoP/EtPh8s8CWuQ7HjwsWnxaGpdhfBM7makrsZvwc8PcX6DDmPmbv/UWN/DMAgrQTWUsPUnTakjSPDbabozlw8vZbDoC6avMRq614z0Z6BOW5qUv0XgN3RhtVVTWS/Pwohlma3RQQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772599288; c=relaxed/simple; bh=nTnfRhRJMckp340lWLTDQoIkY6mvLW+nk013FmeqEz0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kPpKpnCo99HUly6i80jZ3ICer6lMqXMSMdZyM/Qq1KMkppxrNd3L1xtVNoGQSLyrtxC1gDixnC2tNIpScOnwFZaFVs1aNy4ZMMxiAGkghhV0Kv3iJD6SpAp/mVvqF3vLuk6n4DHMB4p4FQIU3PgwDBpYBsF/PFtXUHhm07wCk6Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=EV931DHA; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="EV931DHA" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 089FDC2BC9E; Wed, 4 Mar 2026 04:41:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772599288; bh=nTnfRhRJMckp340lWLTDQoIkY6mvLW+nk013FmeqEz0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EV931DHAiKMtwvkYfYmHhfhN/0FZek1fgBPfYn8g0n4wNHd/3yS5HXIwPl784LK07 O8tH1R+5W8pA7orBtjjHjWKFfgNpVXDuNGiJ5Ate34Wtptf7lp6CNA5bVDa4KfBn6n w586nH+D6+FOhoCTRbyGCBZbipUfv9Xeo78JGAOdkpeFBElLqODU8Y7J/sZqpUCPfm Z2rtDXs/Q6ccq8kNK6Aj34+CtClK7qxRkChUpJkPKSs6JVZIhblbPuMaxnzYSH9vQO wWj0ag5TI0aGnwofyTUFgDWsqMZ3X93ADOFI7/4oQd9sU4DQCRbRQiMkEbp4Er22P4 dawZMVXPcsENg== From: SeongJae Park To: Cc: SeongJae Park , Andrew Morton , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH v2 01/10] mm/damon/core: introduce damos_quota_goal_tuner Date: Tue, 3 Mar 2026 20:41:10 -0800 Message-ID: <20260304044122.79394-2-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260304044122.79394-1-sj@kernel.org> References: <20260304044122.79394-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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=3DZsM1yX+MXx0ozVdsXnFqF4p0g+kATEitr= WyZFfg@mail.gmail.com [2] https://lore.kernel.org/20260204022537.814-1-yunjeong.mun@sk.com Signed-off-by: SeongJae Park --- 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; }; =20 +/** + * 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; =20 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_patt= ern *pattern, scheme->quota =3D *(damos_quota_init(quota)); /* quota.goals should be separately set by caller */ INIT_LIST_HEAD(&scheme->quota.goals); + scheme->quota.goal_tuner =3D quota->goal_tuner; =20 scheme->wmarks =3D *wmarks; scheme->wmarks.activated =3D true; @@ -904,6 +905,7 @@ static int damos_commit_quota(struct damos_quota *dst, = struct damos_quota *src) err =3D damos_commit_quota_goals(dst, src); if (err) return err; + dst->goal_tuner =3D src->goal_tuner; dst->weight_sz =3D src->weight_sz; dst->weight_nr_accesses =3D src->weight_nr_accesses; dst->weight_age =3D src->weight_age; --=20 2.47.3 From nobody Thu Apr 9 09:25:49 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 71571364E9E; Wed, 4 Mar 2026 04:41:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772599288; cv=none; b=bpHZpzWU/UhqCYqOwjLjBfQZiyszAeZ/EI/2DU3e3bFWkgk6YzDxTdcWOkLvcsO+bocdu9/+1OANvDvmUlty30+08pEv0vKNru7JTdqE9UlR1213d0j6YmoYDtJ6Bt+LhvVktD+MlDwfhXV7i7Miq8PvY2rB38nl2mf0ePl2TgQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772599288; c=relaxed/simple; bh=FSeP1l4raWSiTzOnRD3+mpl3eioMh5Ef7ZEq1X1JgZY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VI6R8O1NQD5CVA8TTW4UVwRvGW8dorxRHF74jDs8XoDqwz49WWRgXIrRYng0rCMK7O6Jg7byIsKkDmy00kgPIqyd1/Tw8jM6ra0rwbJKEYyZY7r8t2m8Ab200MSPbqcHs0Tj6cMUVluq+BsQzF6NkrIQ+Y9KanKnXhdoXdSc6EY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=u3ep8KwJ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="u3ep8KwJ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B473C2BCB4; Wed, 4 Mar 2026 04:41:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772599288; bh=FSeP1l4raWSiTzOnRD3+mpl3eioMh5Ef7ZEq1X1JgZY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u3ep8KwJcHwF+wcxjnesOCYJHluM81kV9IESbDiVACHnoP/1vN/7revdp1jrXupSL IXD2vIgFe+xnhLsU/0exnuEVJuOwkxWCK/wiQPxYoeJMKvYle9XBJ/9O/G5w5qSdnY Z2SqdIVlDKGqEwfr6V2XcJsyN2cNrrXsopyAycqdaQ7vjs28flwVP48nY/iTeS34+j cj+7/1SdDdkFae2S6szZcsj7bGK/tbHw9Si4BcEAXGAu9XVRjZ+Gu447DuVO3iuYSS j2Jev7XRN7xc/R8LCQup2APC2B4PP7XpGqfRHmNhc2eRFR1nzir17GAofvPlRRmEpj R1eNG/e8mYXlA== From: SeongJae Park To: Cc: SeongJae Park , Andrew Morton , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH v2 02/10] mm/damon/core: allow quota goals set zero effective size quota Date: Tue, 3 Mar 2026 20:41:11 -0800 Message-ID: <20260304044122.79394-3-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260304044122.79394-1-sj@kernel.org> References: <20260304044122.79394-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" User-explicit quotas (size and time quotas) having zero value means the quotas are unset. And, effective size quota is set as the minimum value of the explicit quotas. When quota goals are set, the goal-based quota tuner can make it lower. But the existing only single tuner never sets the effective size quota zero. Because of the fact, DAMON core assumes zero effective quota means the user has set no quota. Multiple tuners are now allowed, though. In the future, some tuners might want to set a zero effective size quota. There is no reason to restrict that. Meanwhile, because of the current implementation, it will only deactivate all quotas and make the scheme work at its full speed. Introduce a dedicated function for checking if no quota is set. The function checks the fact by showing if the user-set explicit quotas are zero and no goal is installed. It is decoupled from zero effective quota, and hence allows future tuners set zero effective quota for intentionally deactivating the scheme by a purpose. Signed-off-by: SeongJae Park Suggested-by: Gutierrez Asier --- mm/damon/core.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/mm/damon/core.c b/mm/damon/core.c index c5503fdb10bb7..d657b87dd99e8 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -387,6 +387,11 @@ void damos_destroy_quota_goal(struct damos_quota_goal = *g) damos_free_quota_goal(g); } =20 +static bool damos_quota_goals_empty(struct damos_quota *q) +{ + return list_empty(&q->goals); +} + /* initialize fields of @quota that normally API users wouldn't set */ static struct damos_quota *damos_quota_init(struct damos_quota *quota) { @@ -1782,12 +1787,24 @@ static bool __damos_valid_target(struct damon_regio= n *r, struct damos *s) r->age <=3D s->pattern.max_age_region; } =20 +/* + * damos_quota_set() - Return if the given quota is actually set. + * @quota: The quota to check. + * + * Returns true if the quota is set, false otherwise. + */ +static bool damos_quota_set(struct damos_quota *quota) +{ + return quota->esz || quota->sz || quota->ms || + !damos_quota_goals_empty(quota); +} + static bool damos_valid_target(struct damon_ctx *c, struct damon_region *r, struct damos *s) { bool ret =3D __damos_valid_target(r, s); =20 - if (!ret || !s->quota.esz || !c->ops.get_scheme_score) + if (!ret || !damos_quota_set(&s->quota) || !c->ops.get_scheme_score) return ret; =20 return c->ops.get_scheme_score(c, r, s) >=3D s->quota.min_score; @@ -2057,7 +2074,8 @@ static void damos_apply_scheme(struct damon_ctx *c, s= truct damon_target *t, } =20 if (c->ops.apply_scheme) { - if (quota->esz && quota->charged_sz + sz > quota->esz) { + if (damos_quota_set(quota) && + quota->charged_sz + sz > quota->esz) { sz =3D ALIGN_DOWN(quota->esz - quota->charged_sz, c->min_region_sz); if (!sz) @@ -2076,7 +2094,8 @@ static void damos_apply_scheme(struct damon_ctx *c, s= truct damon_target *t, quota->total_charged_ns +=3D timespec64_to_ns(&end) - timespec64_to_ns(&begin); quota->charged_sz +=3D sz; - if (quota->esz && quota->charged_sz >=3D quota->esz) { + if (damos_quota_set(quota) && + quota->charged_sz >=3D quota->esz) { quota->charge_target_from =3D t; quota->charge_addr_from =3D r->ar.end + 1; } @@ -2104,7 +2123,7 @@ static void damon_do_apply_schemes(struct damon_ctx *= c, continue; =20 /* Check the quota */ - if (quota->esz && quota->charged_sz >=3D quota->esz) + if (damos_quota_set(quota) && quota->charged_sz >=3D quota->esz) continue; =20 if (damos_skip_charged_region(t, r, s, c->min_region_sz)) @@ -2389,7 +2408,7 @@ static void damos_adjust_quota(struct damon_ctx *c, s= truct damos *s) /* New charge window starts */ if (time_after_eq(jiffies, quota->charged_from + msecs_to_jiffies(quota->reset_interval))) { - if (quota->esz && quota->charged_sz >=3D quota->esz) + if (damos_quota_set(quota) && quota->charged_sz >=3D quota->esz) s->stat.qt_exceeds++; quota->total_charged_sz +=3D quota->charged_sz; quota->charged_from =3D jiffies; --=20 2.47.3 From nobody Thu Apr 9 09:25:49 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A218637F757; Wed, 4 Mar 2026 04:41:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772599288; cv=none; b=sEUd0JwwE31ZEaaLg6YiTVxVFp4/8Q4vjKVtCa6yun5Gtq4XT4tlR3Moy6ycNI+7ndNCBf2m8lxgb0aqejgK/cu3+xxPZOF+NTqVRPGwwJNTSC1LIeSgCIhBEdlXmrhxsgS26RCxLlHHorX6sghZT0at9uhEFDKZgIU2ysUS8gY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772599288; c=relaxed/simple; bh=QHI34cc7GPySMrww748vR+nu09NVGXEeGECMJAgm4jE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Wxug4uFpNQu/3z7D9nAn9QNRlbNm/xOcJ3PxJqncgSNk1Y1Huk6EuUnbA1jo+C2hoGxchVniJi/cJchMbXE4aE38Hl1z+BEegcFD1MSvh5VUkZmpBl4w0aIzKEoLEHK47UuoxjfemgBkYdD9RCX61gJb+GVTYNON7aUFd+z2K18= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ONaNs8x3; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ONaNs8x3" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 71A9DC2BCB2; Wed, 4 Mar 2026 04:41:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772599288; bh=QHI34cc7GPySMrww748vR+nu09NVGXEeGECMJAgm4jE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ONaNs8x3vsqddIqGapimPOCja1sezVwIF4WxYgGdeYG+NG8zNawDZImfrPTY1JbJU c5rP/KE86iJpVugDN4qKf2PpnLakeN9DMIQYM5y34jAMIeJU6Jk3wyGjVvT+wdoQH0 0kk37hPC8zooX3XBqPFDSu2mhFlVB6R4Mr7ShghG1BYSf/zg2iA1sBRm7uEiEBHchX oWbrEQkHf+6d7s35Q2Ikq411qCiGPUQUZo24RZUaihUxQepoxp6yOjSQUUDUjjVV0F AdfAcI3hUTaFZn1vX+QBKqiCkZ02m+l9oUTqVFf66WJjvNlTA5c+7EQc7ywxTLg/Uo NRngNd4otMCiw== From: SeongJae Park To: Cc: SeongJae Park , Andrew Morton , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH v2 03/10] mm/damon/core: introduce DAMOS_QUOTA_GOAL_TUNER_TEMPORAL Date: Tue, 3 Mar 2026 20:41:12 -0800 Message-ID: <20260304044122.79394-4-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260304044122.79394-1-sj@kernel.org> References: <20260304044122.79394-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Introduce a new goal-based DAMOS quota auto-tuning algorithm, namely DAMOS_QUOTA_GOAL_TUNER_TEMPORAL (temporal in short). The algorithm aims to trigger the DAMOS action only for a temporal time, to achieve the goal as soon as possible. For the temporal period, it uses as much quota as allowed. Once the goal is achieved, it sets the quota zero, so effectively makes the scheme be deactivated. Signed-off-by: SeongJae Park --- include/linux/damon.h | 2 ++ mm/damon/core.c | 29 ++++++++++++++++++++++++----- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/include/linux/damon.h b/include/linux/damon.h index 63f1e3fdd3866..c4095b34f7929 100644 --- a/include/linux/damon.h +++ b/include/linux/damon.h @@ -216,9 +216,11 @@ struct damos_quota_goal { /** * enum damos_quota_goal_tuner - Goal-based quota tuning logic. * @DAMOS_QUOTA_GOAL_TUNER_CONSIST: Aim long term consistent quota. + * @DAMOS_QUOTA_GOAL_TUNER_TEMPORAL: Aim zero quota asap. */ enum damos_quota_goal_tuner { DAMOS_QUOTA_GOAL_TUNER_CONSIST, + DAMOS_QUOTA_GOAL_TUNER_TEMPORAL, }; =20 /** diff --git a/mm/damon/core.c b/mm/damon/core.c index d657b87dd99e8..51401d35f1b6b 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -2337,6 +2337,26 @@ static unsigned long damos_quota_score(struct damos_= quota *quota) return highest_score; } =20 +static void damos_goal_tune_esz_bp_consist(struct damos_quota *quota) +{ + unsigned long score =3D damos_quota_score(quota); + + quota->esz_bp =3D damon_feed_loop_next_input( + max(quota->esz_bp, 10000UL), score); +} + +static void damos_goal_tune_esz_bp_temporal(struct damos_quota *quota) +{ + unsigned long score =3D damos_quota_score(quota); + + if (score >=3D 10000) + quota->esz_bp =3D 0; + else if (quota->sz) + quota->esz_bp =3D quota->sz * 10000; + else + quota->esz_bp =3D ULONG_MAX; +} + /* * Called only if quota->ms, or quota->sz are set, or quota->goals is not = empty */ @@ -2351,11 +2371,10 @@ static void damos_set_effective_quota(struct damos_= quota *quota) } =20 if (!list_empty("a->goals)) { - unsigned long score =3D damos_quota_score(quota); - - quota->esz_bp =3D damon_feed_loop_next_input( - max(quota->esz_bp, 10000UL), - score); + if (quota->goal_tuner =3D=3D DAMOS_QUOTA_GOAL_TUNER_CONSIST) + damos_goal_tune_esz_bp_consist(quota); + else if (quota->goal_tuner =3D=3D DAMOS_QUOTA_GOAL_TUNER_TEMPORAL) + damos_goal_tune_esz_bp_temporal(quota); esz =3D quota->esz_bp / 10000; } =20 --=20 2.47.3 From nobody Thu Apr 9 09:25:49 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D488337F8A2; Wed, 4 Mar 2026 04:41:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772599288; cv=none; b=SawYouLy3FBY2i51BJGOmI6TvTF36GK8n3KIfgGWFhuO1Ue8S42ifi0ub3ZxwuUXZtYOGtZcs2Om+6GQEFTg8o+B+rOXe7QfL0Q4uC9RzQa62H0HufcswyGXEehvYvA3gYTAUnYjr6SCBEZy58MLtkgxWlPG0sJ+5sadPif+FIw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772599288; c=relaxed/simple; bh=Cz0dujDOIX0D2wsuyXTUh/TXx2EbdEyN7109tlsNnZY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=F9/Uftb6npp65qIj4MC0idNl4Xh1FCGkVLDIf3iDj/OaKnMhKrV9ZT70erI7qgRtaMdHCI6z8AQvTMDGQlNezoTw0ey6KPBKSBCICRaQiTbJ10RZ7tfx6h+SQnoZF8NGs417ARxnVFdm7vJ54R8lhF5OxXVuLDbTxygplEgsl8Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=SqDXw3W0; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="SqDXw3W0" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A2304C19423; Wed, 4 Mar 2026 04:41:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772599288; bh=Cz0dujDOIX0D2wsuyXTUh/TXx2EbdEyN7109tlsNnZY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SqDXw3W0NvWmeE+6mfw9826vhRUL+IYxvIT1g0hxflbTAQReC+zO17jRTJ/k70Dw3 vIRctIxYEcOgvqYKEfJgr8acdwqdA/k0jP7gAKpqj78BMscunzq3qn0HMZnI4/ACn/ 9tuw20Eu7Zc0qIW8++W2aPzr0vqpQz9wG4M6rTHtjc78w4NcxJ2qW/HD9PrmSlJOkh A4XoU/8/mehdTuAjY3mcl2cyb7JUKzoc7kLZrhFMTDvfQMkotsldejxe4TNjwFo+Bh sQEUw4ZzMWlJqgFzX0chsvmojPt1qCpe4drrTBuAUri9CKDo3GayIeTM5u03R3hsGa PN3VTPBFtzKXA== From: SeongJae Park To: Cc: SeongJae Park , Andrew Morton , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH v2 04/10] mm/damon/sysfs-schemes: implement quotas->goal_tuner file Date: Tue, 3 Mar 2026 20:41:13 -0800 Message-ID: <20260304044122.79394-5-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260304044122.79394-1-sj@kernel.org> References: <20260304044122.79394-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add a new DAMON sysfs interface file, namely 'goal_tuner' under the DAMOS quotas directory. It is connected to the damos_quota->goal_tuner field. Users can therefore select their favorite goal-based quotas tuning algorithm by writing the name of the tuner to the file. Reading the file returns the name of the currently selected tuner. Signed-off-by: SeongJae Park --- mm/damon/sysfs-schemes.c | 58 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/mm/damon/sysfs-schemes.c b/mm/damon/sysfs-schemes.c index 3a0782e576fab..5186966dafb35 100644 --- a/mm/damon/sysfs-schemes.c +++ b/mm/damon/sysfs-schemes.c @@ -1488,6 +1488,7 @@ struct damon_sysfs_quotas { unsigned long sz; unsigned long reset_interval_ms; unsigned long effective_sz; /* Effective size quota in bytes */ + enum damos_quota_goal_tuner goal_tuner; }; =20 static struct damon_sysfs_quotas *damon_sysfs_quotas_alloc(void) @@ -1610,6 +1611,58 @@ static ssize_t effective_bytes_show(struct kobject *= kobj, return sysfs_emit(buf, "%lu\n", quotas->effective_sz); } =20 +struct damos_sysfs_qgoal_tuner_name { + enum damos_quota_goal_tuner tuner; + char *name; +}; + +static struct damos_sysfs_qgoal_tuner_name damos_sysfs_qgoal_tuner_names[]= =3D { + { + .tuner =3D DAMOS_QUOTA_GOAL_TUNER_CONSIST, + .name =3D "consist", + }, + { + .tuner =3D DAMOS_QUOTA_GOAL_TUNER_TEMPORAL, + .name =3D "temporal", + }, +}; + +static ssize_t goal_tuner_show(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) +{ + struct damon_sysfs_quotas *quotas =3D container_of(kobj, + struct damon_sysfs_quotas, kobj); + int i; + + for (i =3D 0; i < ARRAY_SIZE(damos_sysfs_qgoal_tuner_names); i++) { + struct damos_sysfs_qgoal_tuner_name *tuner_name; + + tuner_name =3D &damos_sysfs_qgoal_tuner_names[i]; + if (tuner_name->tuner =3D=3D quotas->goal_tuner) + return sysfs_emit(buf, "%s\n", tuner_name->name); + } + return -EINVAL; +} + +static ssize_t goal_tuner_store(struct kobject *kobj, + struct kobj_attribute *attr, const char *buf, size_t count) +{ + struct damon_sysfs_quotas *quotas =3D container_of(kobj, + struct damon_sysfs_quotas, kobj); + int i; + + for (i =3D 0; i < ARRAY_SIZE(damos_sysfs_qgoal_tuner_names); i++) { + struct damos_sysfs_qgoal_tuner_name *tuner_name; + + tuner_name =3D &damos_sysfs_qgoal_tuner_names[i]; + if (sysfs_streq(buf, tuner_name->name)) { + quotas->goal_tuner =3D tuner_name->tuner; + return count; + } + } + return -EINVAL; +} + static void damon_sysfs_quotas_release(struct kobject *kobj) { kfree(container_of(kobj, struct damon_sysfs_quotas, kobj)); @@ -1627,11 +1680,15 @@ static struct kobj_attribute damon_sysfs_quotas_res= et_interval_ms_attr =3D static struct kobj_attribute damon_sysfs_quotas_effective_bytes_attr =3D __ATTR_RO_MODE(effective_bytes, 0400); =20 +static struct kobj_attribute damon_sysfs_quotas_goal_tuner_attr =3D + __ATTR_RW_MODE(goal_tuner, 0600); + static struct attribute *damon_sysfs_quotas_attrs[] =3D { &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, + &damon_sysfs_quotas_goal_tuner_attr.attr, NULL, }; ATTRIBUTE_GROUPS(damon_sysfs_quotas); @@ -2718,6 +2775,7 @@ static struct damos *damon_sysfs_mk_scheme( .weight_sz =3D sysfs_weights->sz, .weight_nr_accesses =3D sysfs_weights->nr_accesses, .weight_age =3D sysfs_weights->age, + .goal_tuner =3D sysfs_quotas->goal_tuner, }; struct damos_watermarks wmarks =3D { .metric =3D sysfs_wmarks->metric, --=20 2.47.3 From nobody Thu Apr 9 09:25:49 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 546C537F8C4; Wed, 4 Mar 2026 04:41:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772599289; cv=none; b=Wr2xMkxvBSO9lFVj4OVukX46UBbvqQW33JS+nX2YJ16Nqn9bs7JVMZJXScRRNUuQTVF3/xct21RQMdfHnhhe4RSP7i2niubg6OyVJZT5Ug22/209SqsYXfsFm7hCpMbxuF9U4CJtcZ+/IKpm2N90wHHAcll+OzmGWMmk/0xl1co= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772599289; c=relaxed/simple; bh=BRPVQ//gFwEK7BX6XnTBEauvn4um7HRHs55ygHmJ5MY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VV7C18uF21JCnqVJhdG7puu2wD3WO+cZYdOQ/00V2gum2qzvSYYAvYThCwQRLASyx/5tLaB9XS5gedJGuvPkEqhjK3K7i7wBly0m9OONUjCO8vgYGOAL9jWq0MVde0v8gyTRSVppsI9EB331M9WnS/KtjCTTfP83QKERFqlY5x4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=drGqn8oa; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="drGqn8oa" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5912C2BCAF; Wed, 4 Mar 2026 04:41:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772599289; bh=BRPVQ//gFwEK7BX6XnTBEauvn4um7HRHs55ygHmJ5MY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=drGqn8oasNMPpRGlhAVrnnqVCuASZrV5LJe28KZ7+yMqDFjIfwo3qSejyNL+lvPck 8nuOYiRbROexyxJYKh4PbkVpIpcPyPwuoYLupU9EhZ7uqocsHsmMEhWn6VfWaGQwOT pBgRSbF2r1ZonJCXHSJn0bMHnOPSGtJDzlgA3iLhyfxFb/8sTrBaByila6IXVC4QzE Tcvm9sRda6B2KP0ywrJh7QdzdVvE3tP7ai4oSIStmu2d4geB22MXDbcw78VC1Uow2/ NHUeVU68Qk8AsGzbkszZfUbqTqkf7ZQU/pTP9mIewE092cN7/fg1d/KGitPokgStKx 66e6IhuPilUdw== From: SeongJae Park To: Cc: SeongJae Park , "Liam R. Howlett" , Andrew Morton , David Hildenbrand , Jonathan Corbet , Lorenzo Stoakes , Michal Hocko , Mike Rapoport , Shuah Khan , Suren Baghdasaryan , Vlastimil Babka , damon@lists.linux.dev, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH v2 05/10] Docs/mm/damon/design: document the goal-based quota tuner selections Date: Tue, 3 Mar 2026 20:41:14 -0800 Message-ID: <20260304044122.79394-6-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260304044122.79394-1-sj@kernel.org> References: <20260304044122.79394-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Update the design document for the newly added goal-based quota tuner selection feature. Signed-off-by: SeongJae Park --- Documentation/mm/damon/design.rst | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Documentation/mm/damon/design.rst b/Documentation/mm/damon/des= ign.rst index dd64f5d7f3193..28d932ceaf7ed 100644 --- a/Documentation/mm/damon/design.rst +++ b/Documentation/mm/damon/design.rst @@ -564,6 +564,18 @@ aggressiveness (the quota) of the corresponding scheme= . For example, if DAMOS is under achieving the goal, DAMOS automatically increases the quota. If = DAMOS is over achieving the goal, it decreases the quota. =20 +There are two such tuning algorithms that users can select as they need. + +- ``consist``: A proportional feedback loop based algorithm. Tries to fin= d an + optimum quota that should be consistently kept, to keep achieving the go= al. + Useful for kernel-only operation on dynamic and long-running environment= s. + This is the default selection. If unsure, use this. +- ``temporal``: More straightforward algorithm. Tries to achieve the goal= as + fast as possible, using maximum allowed quota, but only for a temporal s= hort + time. When the quota is under-achieved, this algorithm keeps tuning quo= ta to + a maximum allowed one. Once the quota is [over]-achieved, this sets the + quota zero. Useful for deterministic control required environments. + The goal can be specified with five parameters, namely ``target_metric``, ``target_value``, ``current_value``, ``nid`` and ``path``. The auto-tuning mechanism tries to make ``current_value`` of ``target_metric`` be same to --=20 2.47.3 From nobody Thu Apr 9 09:25:49 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 96DFF37F8D4; Wed, 4 Mar 2026 04:41:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772599289; cv=none; b=RkberIrtJzKISJK3arPCchBdby67UTDiq82t04iOYaKmRQPOXp1A+zG1gq/RxbcWVXc41uVUPCr5pyKBSzaUnn07r1fR62Y9Nvhes06TFdKJcXpclPC+5zrRVnxc/NuB+M4InkSgP9c+kdyi+42WKeLiMS4fN1NGNq0WIBr5OhY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772599289; c=relaxed/simple; bh=8g5RM84PzzTOH9XhkrAPhPyfvWGkJhpn6rsV5ukGTjU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=uwq+4sTtf8vXC0UGPWtuO2pxOq05bCqCLkGTzcTAPSrnMpaBNUq1GXF7EPBBy0uiuZCKfrqlm0gYp3Wwfh0nAEIugPRQnId+9qnGrBED5Rt+lTdqOqwadtXESHqkSfbwtY2pjanltnoste82iyVsM5JSeRnpTidxgw2DfPGZI5I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Mnx/ae8y; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Mnx/ae8y" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3D87DC2BCB0; Wed, 4 Mar 2026 04:41:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772599289; bh=8g5RM84PzzTOH9XhkrAPhPyfvWGkJhpn6rsV5ukGTjU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Mnx/ae8y7orLmFJZHFXSsQfrn7bza4w09l7fsKmvHiaNUshtMFj6Os3q0otSdDFX+ U/bZQpkt7velykvuZOTLKV40p0S/b6/t99O/nfrcU72o2G6oWQpK09W1PIy0xjLULc 8SIQKD+x5zKXo3samKrGB0lb1e3mhx6ylYRL7kQnK9iezNXgtT2OKntGmdM1Dh7+cd +n39fBAnoT+Q8Oe/htB5t+MF9o2dRomk6xNk01gQk4LcZ8JZ5ZfaQdZcIDz38dN/yH Qzra+z04nJcXBz/yAfG6J8dFxGFK/YIolLjiDRyB7zhv7mDo7TijM1AQoROTuRLsP6 X5l3cYn7g+xPg== From: SeongJae Park To: Cc: SeongJae Park , "Liam R. Howlett" , Andrew Morton , David Hildenbrand , Jonathan Corbet , Lorenzo Stoakes , Michal Hocko , Mike Rapoport , Shuah Khan , Suren Baghdasaryan , Vlastimil Babka , damon@lists.linux.dev, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH v2 06/10] Docs/admin-guide/mm/damon/usage: document goal_tuner sysfs file Date: Tue, 3 Mar 2026 20:41:15 -0800 Message-ID: <20260304044122.79394-7-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260304044122.79394-1-sj@kernel.org> References: <20260304044122.79394-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Update the DAMON usage document for the new sysfs file for the goal based quota auto-tuning algorithm selection. Signed-off-by: SeongJae Park --- Documentation/admin-guide/mm/damon/usage.rst | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Documentation/admin-guide/mm/damon/usage.rst b/Documentation/a= dmin-guide/mm/damon/usage.rst index b0f3969b6b3b1..534e1199cf091 100644 --- a/Documentation/admin-guide/mm/damon/usage.rst +++ b/Documentation/admin-guide/mm/damon/usage.rst @@ -83,7 +83,7 @@ comma (","). =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 = =E2=94=82 sz/min,max =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 = =E2=94=82 nr_accesses/min,max =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 = =E2=94=82 age/min,max - =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 = :ref:`quotas `/ms,bytes,reset_interval_ms,effective_bytes + =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 = :ref:`quotas `/ms,bytes,reset_interval_ms,effective_bytes,goa= l_tuner =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 = =E2=94=82 weights/sz_permil,nr_accesses_permil,age_permil =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 = =E2=94=82 :ref:`goals `/nr_goals =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 = =E2=94=82 =E2=94=82 0/target_metric,target_value,current_value,nid,path @@ -377,9 +377,9 @@ schemes//quotas/ The directory for the :ref:`quotas ` of the giv= en DAMON-based operation scheme. =20 -Under ``quotas`` directory, four files (``ms``, ``bytes``, -``reset_interval_ms``, ``effective_bytes``) and two directories (``weights= `` and -``goals``) exist. +Under ``quotas`` directory, five files (``ms``, ``bytes``, +``reset_interval_ms``, ``effective_bytes`` and ``goal_tuner``) and two +directories (``weights`` and ``goals``) exist. =20 You can set the ``time quota`` in milliseconds, ``size quota`` in bytes, a= nd ``reset interval`` in milliseconds by writing the values to the three file= s, @@ -390,6 +390,14 @@ apply the action to only up to ``bytes`` bytes of memo= ry regions within the quota limits unless at least one :ref:`goal ` is set. =20 +You can set the goal-based effective quota auto-tuning algorithm to use, by +writing the algorithm name to ``goal_tuner`` file. Reading the file retur= ns +the currently selected tuner algorithm. Refer to the design documentation= of +:ref:`automatic quota tuning goals = ` for +the background design of the feature and the name of the selectable algori= thms. +Refer to :ref:`goals directory ` for the goals +setup. + The time quota is internally transformed to a size quota. Between the transformed size quota and user-specified size quota, smaller one is appli= ed. Based on the user-specified :ref:`goal `, the --=20 2.47.3 From nobody Thu Apr 9 09:25:49 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C4D2137F8DF; Wed, 4 Mar 2026 04:41:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772599289; cv=none; b=t5cChGZLZrdqGVN7DEN9SlZA0tPOfr1fP75ndx1ZtMXrpcP9Ux6GQud8xdAh7wq42iwM8Nq4g+Mrg98q2jjj3N253MiUxMJCXrUcct+GKg1+BJb0X2TKDZTmttDIfIEqfrCjCOUFCNepeZ6Jn131m5+wFq9WCvE4Jq0qvi2MnoU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772599289; c=relaxed/simple; bh=X4gj60NUP5Gx9WKLfYMZxZSkKyfsCySS7inf5fgIm6M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HghPooBnMtiwUE4jQ0AAtxvKMbuosWEEtzc4CaSlwrXBqtMLA2cvJQQJhRHPR6ShA7GjpSHmYk7g3wLEmLObSVWV4ONxoL8jwAZ4E4yXMfw7Rx9cYOwVxZdvGKjqNt3GUP2auIE1nrItczLh1mxLQV82W4n1V16mEk7ao3hybow= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=tbFpVsFl; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="tbFpVsFl" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 98C5FC2BC9E; Wed, 4 Mar 2026 04:41:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772599289; bh=X4gj60NUP5Gx9WKLfYMZxZSkKyfsCySS7inf5fgIm6M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tbFpVsFlnQBOtv+KJazEbh0Cy0dQ0f6CkZ9Z4jYoAEgvMP5BuHO77eD2CSvnppaH6 hv5QGfbB/P1y/D2dZM7sH0Zx+Gp13w2oAimfgHw57a3RQIzacYm6SYOhiinjni88D3 oTG9iK90CaX2wJWK3QL1ELhTKa8oR0t7DqB6BR9dxB+nabx5MoZyqq0WwIasgprgdt /LFnEguaqIVjbjxJAqiHgZ+p3LqUhekNa/gAp8kkkOiSP1JPLP+BVTOsmS3j2QXM42 KCvhd/V2N7qXB+tqoxyqUyDx1P6zZ1hVr8Gveq/3Xxh7osOJ9WmdF4aJCs5WpXE/ye C+L04GDYmD14g== From: SeongJae Park To: Cc: SeongJae Park , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH v2 07/10] Docs/ABI/damon: update for goal_tuner Date: Tue, 3 Mar 2026 20:41:16 -0800 Message-ID: <20260304044122.79394-8-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260304044122.79394-1-sj@kernel.org> References: <20260304044122.79394-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Update the ABI document for the newly added goal_tuner sysfs file. Signed-off-by: SeongJae Park --- Documentation/ABI/testing/sysfs-kernel-mm-damon | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-kernel-mm-damon b/Documentatio= n/ABI/testing/sysfs-kernel-mm-damon index f2af2ddedd323..2424237ebb105 100644 --- a/Documentation/ABI/testing/sysfs-kernel-mm-damon +++ b/Documentation/ABI/testing/sysfs-kernel-mm-damon @@ -316,6 +316,12 @@ Contact: SeongJae Park Description: Writing to and reading from this file sets and gets the path parameter of the goal. =20 +What: /sys/kernel/mm/damon/admin/kdamonds//contexts//schemes//qu= otas/goal_tuner +Date: Mar 2026 +Contact: SeongJae Park +Description: Writing to and reading from this file sets and gets the + goal-based effective quota auto-tuning algorithm to use. + What: /sys/kernel/mm/damon/admin/kdamonds//contexts//schemes//qu= otas/weights/sz_permil Date: Mar 2022 Contact: SeongJae Park --=20 2.47.3 From nobody Thu Apr 9 09:25:49 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2B60437FF54; Wed, 4 Mar 2026 04:41:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772599290; cv=none; b=Lhxf6Wlwkkr4jaD+xVdylL4eth+nZBaSBYsi6K0kZKLZe3rqatYfYdFqckk7AfKUj1DDNCD0abObK+55V6zOheckHTlxyvcCTYbFJiidxxumSb4TqmfyVwD444qPDu7U+IXmIT2oLDrem2h2/l2AU62awWTyjVwLYlJJnsbXvQ8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772599290; c=relaxed/simple; bh=+HQX6Y6KyyaMrF3l90vkRlVOFR5aGGsrQWEn3/nSaHo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=M8HFgXMA4FIdHGM3F6UQY5gvyseV/72ZVkw8FAMR4VeO+VtrxDUTAKTk8V8w50hlvDI3wa3PHVrhcC3W84Gh9HyU7muN+OV8V7yERC9GIpdgte4BKF867XEKWU/vJ5mMjqh/g9CxLCUmwf/qt7EdYMBzExUHf7LGQA4Xw6Ippss= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jOANUg29; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jOANUg29" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5FACC19423; Wed, 4 Mar 2026 04:41:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772599289; bh=+HQX6Y6KyyaMrF3l90vkRlVOFR5aGGsrQWEn3/nSaHo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jOANUg29JEMAPQXfb4thilzOeD36TUkrZ81dBj5gH2D+LNQbIVWdhnWG5NHTwV0pZ gG5GLW/GaATT0afiYCs/w1glhlFTps9RK/5ybhSFNVvFX0V5NViHW/ctN2HDu/Z2Aq mtpPZ4/4ZZpbdqEi0YG/gxt3qLkkXLk4g+I6ehv1K+oeAGE55FuFmZnvH7/IxWptKF G0C+VJ6uqiqehkVxHiXaUMwNJnLv5OF+d0cFcHtqjAwx6ZtX3d4NO946bS5hQDgall mQYiEqdUxGwqtcN0JhOJlh4FYTk7WjklMh//kBC8zIx+bv9x73r2wIPIJ3BNRN85mZ ZGAOB8wTvryUQ== From: SeongJae Park To: Cc: SeongJae Park , Shuah Khan , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH v2 08/10] selftests/damon/_damon_sysfs: support goal_tuner setup Date: Tue, 3 Mar 2026 20:41:17 -0800 Message-ID: <20260304044122.79394-9-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260304044122.79394-1-sj@kernel.org> References: <20260304044122.79394-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add support of goal_tuner setup to the test-purpose DAMON sysfs interface control helper, _damon_sysfs.py. Signed-off-by: SeongJae Park --- tools/testing/selftests/damon/_damon_sysfs.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/damon/_damon_sysfs.py b/tools/testing/= selftests/damon/_damon_sysfs.py index 748778b563cd2..2b4df655d9fd0 100644 --- a/tools/testing/selftests/damon/_damon_sysfs.py +++ b/tools/testing/selftests/damon/_damon_sysfs.py @@ -130,15 +130,16 @@ class DamosQuota: sz =3D None # size quota, in bytes ms =3D None # time quota goals =3D None # quota goals + goal_tuner =3D None # quota goal tuner reset_interval_ms =3D None # quota reset interval weight_sz_permil =3D None weight_nr_accesses_permil =3D None weight_age_permil =3D None scheme =3D None # owner scheme =20 - def __init__(self, sz=3D0, ms=3D0, goals=3DNone, reset_interval_ms=3D0, - weight_sz_permil=3D0, weight_nr_accesses_permil=3D0, - weight_age_permil=3D0): + def __init__(self, sz=3D0, ms=3D0, goals=3DNone, goal_tuner=3D'consist= ', + reset_interval_ms=3D0, weight_sz_permil=3D0, + weight_nr_accesses_permil=3D0, weight_age_permil=3D0): self.sz =3D sz self.ms =3D ms self.reset_interval_ms =3D reset_interval_ms @@ -146,6 +147,7 @@ class DamosQuota: self.weight_nr_accesses_permil =3D weight_nr_accesses_permil self.weight_age_permil =3D weight_age_permil self.goals =3D goals if goals is not None else [] + self.goal_tuner =3D goal_tuner for idx, goal in enumerate(self.goals): goal.idx =3D idx goal.quota =3D self @@ -191,6 +193,10 @@ class DamosQuota: err =3D goal.stage() if err is not None: return err + err =3D write_file( + os.path.join(self.sysfs_dir(), 'goal_tuner'), self.goal_tu= ner) + if err is not None: + return err return None =20 class DamosWatermarks: --=20 2.47.3 From nobody Thu Apr 9 09:25:49 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 401A137FF5C; Wed, 4 Mar 2026 04:41:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772599290; cv=none; b=HCie5BilUSghJrecIvkHcKXUyMk7F7kNZPb54exvVlUSRe0KEehEI1R45IDj2D/z+kulvaI2hAQLLFxZORT1pYbT/hjW0dTh0zxNthETf9E5HN8rwuxD352CBXseOfq1jHEiUbLkoU6oDZA7u+Z5sx7diKsUPX36t3R7Kp+QdPE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772599290; c=relaxed/simple; bh=pVuHdsiSK2hSc3Y/sliHzMztEBUolq4unjdQPlB02FQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Q9xYz4PcePn4+4ScmuJlCa9JfHc+UTl2UWA+o3DZ7HDsq2LM1bOCRdeSOmLcsPlDalq3PuSveOIu5qYbhPgcyUagKTCsI7I6iZTZckY+G9unLatWIViJs1r/4CfEkr187jVj5cfVdJlBUI2Lx+l0xs1zMJ+H/TGWEs2MoLV+iSw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=fADf3l+U; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="fADf3l+U" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A6A9C2BCB0; Wed, 4 Mar 2026 04:41:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772599290; bh=pVuHdsiSK2hSc3Y/sliHzMztEBUolq4unjdQPlB02FQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fADf3l+U3piiHRary8J43NRu2XwjdMj3+DnQaO7Rwm8yWFNEOA4fe46nuP/BIK0TS CHN5r7Boc62uCRf3YKpu1nBSXZoSGv9oddF0Pu5MhD1fMct4LrPia73VErPzHrQ1r+ 0rgE9PYDrOb7UPehZ/sB1jAnp275O14idtv3ZDFnBgyb01JySP1FsI7xebl4YKbpOC WxBBAxeMHsAlRo+7JrdCKCVUPagVPZ2PFpnZhonD20KhC+EyEXCx0+ekePzje8lIJE G+TMUjMwhyaWRI2RqWY2UewFbmRZf3/1KL1OXaLBQYwTU0MASUT3IUE6Kqo9BShBSp RtzOVQcKjebsQ== From: SeongJae Park To: Cc: SeongJae Park , Shuah Khan , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH v2 09/10] selftests/damon/drgn_dump_damon_status: support quota goal_tuner dumping Date: Tue, 3 Mar 2026 20:41:18 -0800 Message-ID: <20260304044122.79394-10-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260304044122.79394-1-sj@kernel.org> References: <20260304044122.79394-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Update drgn_dump_damon_status.py, which is being used to dump the in-kernel DAMON status for tests, to dump goal_tuner setup status. Signed-off-by: SeongJae Park --- tools/testing/selftests/damon/drgn_dump_damon_status.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/testing/selftests/damon/drgn_dump_damon_status.py b/tool= s/testing/selftests/damon/drgn_dump_damon_status.py index 5374d18d1fa8d..af99b07a4f565 100755 --- a/tools/testing/selftests/damon/drgn_dump_damon_status.py +++ b/tools/testing/selftests/damon/drgn_dump_damon_status.py @@ -110,6 +110,7 @@ def damos_quota_to_dict(quota): ['reset_interval', int], ['ms', int], ['sz', int], ['goals', damos_quota_goals_to_list], + ['goal_tuner', int], ['esz', int], ['weight_sz', int], ['weight_nr_accesses', int], --=20 2.47.3 From nobody Thu Apr 9 09:25:49 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 751203803D0; Wed, 4 Mar 2026 04:41:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772599290; cv=none; b=fAIo3dZNBOpw3zyLb446sUlFOMii/JSQORt8BeJxmFlHPCj7B3F61ouPXuGLm6CKwJW6oEGyBIuwoJIchaP2pmEjvxPYUd8yMiYGYeNmjPwSQjCrY3bn86kbvlc+eAN27Mb2rKOVL+NBuopwf+jrkjvh0HCJue62VNq5HuewzZU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772599290; c=relaxed/simple; bh=AVTjUet9MVkl4nT/vo+5gBPPg8P0HSyE/9BxBCU3HWc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jTi1K3NQY56dyrD0lqTfys87G/b3Vnhx/ow+BlAgUGUUbEpE9Mu0ylVqlAukQnfUWKUUhmX+vT+VWHlGdwC0aDfhYC31gfqbuP4EM4FOE6BYtQTwgP/fpDw/hBtsk10LmElF5brHF7cqONr+OXgf++kDujFHHOtT9Mrrjl5Lpr8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=owu092Bd; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="owu092Bd" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 41343C2BCAF; Wed, 4 Mar 2026 04:41:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772599290; bh=AVTjUet9MVkl4nT/vo+5gBPPg8P0HSyE/9BxBCU3HWc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=owu092BdW9Ght3CUa+CqgGkZcipfpcKbiZKHQwtZs5mwggraKUlXSfK5aQE1ryiWO kRy1S4peBQ2sKet+Q9ZKi8PzIxPpRE3ENPgEudPWnO7WRXv5tQIuBtbp2kpp6b3P+s bUAcY7mvUnqXAMtx7mJAeIOwX2+C1IHfRXBE7GR8rW41Is0CHb47g6JxO56Ip8vtTo 10WiSO0k8VVuH1f955KMYieZqcF8T0jT+LEi4VG3XI0jjrb3XZ0WcYlj74/GtihrnE WuyQFxKATb+Y3u6rM5p93iCur43EgVmQ9ZGHwYyVFXlOQgB17P0S92YAn5xn3vEo38 SXkk6NOVEqFAA== From: SeongJae Park To: Cc: SeongJae Park , Shuah Khan , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH v2 10/10] selftests/damon/sysfs.py: test goal_tuner commit Date: Tue, 3 Mar 2026 20:41:19 -0800 Message-ID: <20260304044122.79394-11-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260304044122.79394-1-sj@kernel.org> References: <20260304044122.79394-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Extend the near-full DAMON parameters commit selftest to commit goal_tuner and confirm the internal status is updated as expected. Signed-off-by: SeongJae Park --- tools/testing/selftests/damon/sysfs.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/testing/selftests/damon/sysfs.py b/tools/testing/selftes= ts/damon/sysfs.py index 9cca71eb0325e..3aa5c91548a53 100755 --- a/tools/testing/selftests/damon/sysfs.py +++ b/tools/testing/selftests/damon/sysfs.py @@ -67,6 +67,12 @@ def assert_quota_committed(quota, dump): assert_true(dump['sz'] =3D=3D quota.sz, 'sz', dump) for idx, qgoal in enumerate(quota.goals): assert_quota_goal_committed(qgoal, dump['goals'][idx]) + tuner_val =3D { + 'consist': 0, + 'temporal': 1, + } + assert_true(dump['goal_tuner'] =3D=3D tuner_val[quota.goal_tuner], + 'goal_tuner', dump) assert_true(dump['weight_sz'] =3D=3D quota.weight_sz_permil, 'weight_s= z', dump) assert_true(dump['weight_nr_accesses'] =3D=3D quota.weight_nr_accesses= _permil, 'weight_nr_accesses', dump) @@ -231,6 +237,7 @@ def main(): metric=3D'node_mem_used_bp', target_value=3D9950, nid=3D1)], + goal_tuner=3D'temporal', reset_interval_ms=3D1500, weight_sz_permil=3D20, weight_nr_accesses_permil=3D200, --=20 2.47.3