From nobody Sun Jun 14 18:37:22 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 E63DD3CEB94; Fri, 10 Apr 2026 14:20:44 +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=1775830845; cv=none; b=ukovvVuA53bKmG2x+D3o+xNg+5rh2JqU7qGafZEa1juUHqd5vL8/2h4RYuMCymO9AGvuO9noTs6VcFguvOGxhCUWv9iXl/m6MoQGH7L7P18uPwCRKyEdiOwXNYFoIwSK/D0pGzET0DVFvLg3S0r4EbXkKTbDtckG7et7XkNg7GY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775830845; c=relaxed/simple; bh=npLjo+Ub0jfADcpNQiStOidPGi9YtKWTfRmpcD4bUVw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tvsSxZvq2A0pGp9a5xc0b8cUnl12Cq81ZWRGKp0JVeBERxQTT/DbTSegEFNyHj8kBbbmqNi+JDVnvxpG+T5ZDeR8ihfBEVVMWJ6+kC8jKp01C5Z5805toKyDvCPG5xdTFyESJy8sUfht4q8kS/PuAd/Wv9yvEWxxfNOUz9grnGo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=SDrBY6lO; 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="SDrBY6lO" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A1137C2BCB0; Fri, 10 Apr 2026 14:20:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775830844; bh=npLjo+Ub0jfADcpNQiStOidPGi9YtKWTfRmpcD4bUVw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SDrBY6lOoLv0eknGY/5lH/M+dAhl5dR7PLZ9iP3lwd7QKN1UqPn/aKWLblnDSRCUr QQvNk3xVRS78algihfZ0I7CwtG5xL2DsT3fshLJNdqaoW+ynBJJx8ZlvNOuyPmCAuT tVcCD8RqfDPBaXpkCcljnK/8UrAxVfVRHWCOYK1YatS+pB+OQKqQTIUJLaG0aYG2mK h6QRGDGQJyPTG1y7Muo+uItkLOtqILvTl04kxAFBhIHj25QOXQGHN3blBOsG2OGQg0 9mTxZwrlzlxtseYUR0R4DsAecbVuBdd0If+utR5vVuG30BLKVb/hAl0n2LSHZB5n7H Y8glsMn4WEDEQ== 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 v5 01/11] mm/damon/core: handle X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260410142034.83798-1-sj@kernel.org> References: <20260410142034.83798-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" Less than min_region_sz remaining quota effectively means the quota is fully charged. In other words, no remaining quota. This is because DAMOS actions are applied in the region granularity, and each region should have min_region_sz or larger size. However the existing fully charged quota check, which is also used for setting charge_target_from and charge_addr_from of the quota, is not aware of the case. For the reason, charge_target_from and charge_addr_from of the quota will not be updated in the case. This can result in DAMOS action being applied more frequently to a specific area of the memory. The case is unreal because quota charging is also made in the region granularity. It could be changed in future, though. Actually, the following commit will make the change, by allowing users to set arbitrary quota charging ratio for action-failed regions. To be prepared for the change, update the fully charged quota checks to treat having less than min_region_sz remaining quota as fully charged. Signed-off-by: SeongJae Park --- mm/damon/core.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/mm/damon/core.c b/mm/damon/core.c index e680716972506..c7d05d2385fe8 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -2042,6 +2042,20 @@ static void damos_walk_cancel(struct damon_ctx *ctx) mutex_unlock(&ctx->walk_control_lock); } =20 +static bool damos_quota_is_full(struct damos_quota *quota, + unsigned long min_region_sz) +{ + if (!damos_quota_is_set(quota)) + return false; + if (quota->charged_sz >=3D quota->esz) + return true; + /* + * DAMOS action is applied per region, so esz - quota->charged_sz < min_region_sz; +} + static void damos_apply_scheme(struct damon_ctx *c, struct damon_target *t, struct damon_region *r, struct damos *s) { @@ -2099,8 +2113,7 @@ 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 (damos_quota_is_set(quota) && - quota->charged_sz >=3D quota->esz) { + if (damos_quota_is_full(quota, c->min_region_sz)) { quota->charge_target_from =3D t; quota->charge_addr_from =3D r->ar.end + 1; } @@ -2128,8 +2141,7 @@ static void damon_do_apply_schemes(struct damon_ctx *= c, continue; =20 /* Check the quota */ - if (damos_quota_is_set(quota) && - quota->charged_sz >=3D quota->esz) + if (damos_quota_is_full(quota, c->min_region_sz)) continue; =20 if (damos_skip_charged_region(t, r, s, c->min_region_sz)) @@ -2455,8 +2467,7 @@ static void damos_adjust_quota(struct damon_ctx *c, s= truct damos *s) if (!time_in_range_open(jiffies, quota->charged_from, quota->charged_from + msecs_to_jiffies(quota->reset_interval))) { - if (damos_quota_is_set(quota) && - quota->charged_sz >=3D quota->esz) + if (damos_quota_is_full(quota, c->min_region_sz)) s->stat.qt_exceeds++; quota->total_charged_sz +=3D quota->charged_sz; quota->charged_from =3D jiffies; --=20 2.47.3 From nobody Sun Jun 14 18:37:22 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 6EBD23D0919; Fri, 10 Apr 2026 14:20:45 +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=1775830845; cv=none; b=I+NjYJL3s2gba5CErt+HlCcYkweN7QlXMwaVlwUv0M1fQqJBNtawxDwsshrxRybCga61gazmjMJegD02AibpHhL6aCwdyM+wZlrpZcl/ZoIpZGC2LMD/ZBK1qw5lzIikrUDFPnKQna3zOzjaW5BxJxYxn3zWA506JOJ34Yd059E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775830845; c=relaxed/simple; bh=bRUkpmCPpf8L/6LaFfwvBKwm/4LpPOhSu9Y0BbXCNpY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hG8pQxVuI5QjlNtsyNxivAdyAmncjgKf+VUQ2IAFntzssW91yXQePSoKWjCEy1OnDs3bDQHE0OR+H6aIvCpUnmbiNUysf6tle9NCDHx+Q73Lq5knVzvi6P7MY2Jiod5iKfo/juG9UqsGOXd3BO63zapPzqQTGK0oeNihpG/vMLY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Sa7P2pgv; 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="Sa7P2pgv" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF127C2BC9E; Fri, 10 Apr 2026 14:20:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775830845; bh=bRUkpmCPpf8L/6LaFfwvBKwm/4LpPOhSu9Y0BbXCNpY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Sa7P2pgvXdb/wIm55UTCQrMbVgTdHxtDQvPCc3KJj3Kaex7BTU/5OTffm/cf+kKJ3 6UUSzoRawh2Sciton9d5REsSD23HKgqL9W5PeTijYYQYT/Gdad4P5sddsA2X2YHgUq 7g6ga826N6x3PqZr2hssvcQMol8Gaqw0Zs1Htx5jDUN5tb90j+WowH1weW5ZyXa8h7 Kk67PHk9CslS1FL4LgLbILpMGut2jH14n9l5EpKDEwzqxs5otNppknE/vhxq2fcwCD xw20L5IERd7a+O1uN/U8V0aTpIh9cOg8w97pGG+KKB13tVioa3dyBF2ICCEBqKZV/v Ni5VUIrrfPCNA== 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 v5 02/11] mm/damon/core: merge quota-sliced regions back Date: Fri, 10 Apr 2026 07:20:23 -0700 Message-ID: <20260410142034.83798-3-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260410142034.83798-1-sj@kernel.org> References: <20260410142034.83798-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" damos_apply_scheme() could split the given region if applying the scheme's action to the entire region can result in violating the quota-set upper limit. Keeping regions that are created by such split operations is unnecessary overhead. The overhead would be negligible in the common case because such split operations could happen only up to the number of installed schemes per scheme apply interval. The following commit could make the impact larger, though. The following commit will allow the action-failed region to be charged in a different ratio. If both the ratio and the remaining quota is quite small, and the action is nearly always failing, a high number of split operations could be made. Remove the unnecessary overhead by merging the sliced regions back, as soon as the schemes handling for the slices are done, and there is no reason to keep the sliced regions. The sliced regions may need to be kept if no scheme action is applied to the slice due to the quota being fully charged. That is, the 'age' field of a region is reset when a DAMOS action is applied to the region. If no DAMOS action is applied to the sliced region, the region keeps the age information. If it is merged into the original region, the age information is lost. Signed-off-by: SeongJae Park --- mm/damon/core.c | 39 +++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/mm/damon/core.c b/mm/damon/core.c index c7d05d2385fe8..b0f673efc53c8 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -2159,6 +2159,40 @@ static void damon_do_apply_schemes(struct damon_ctx = *c, } } =20 +static void damos_apply_target(struct damon_ctx *c, struct damon_target *t) +{ + struct damon_region *r, *orig_region =3D NULL; + unsigned long orig_end_addr; + + damon_for_each_region(r, t) { + /* + * damon_do_apply_schemes() could split the region for the + * quota. Keeping the new slices is an overhead. Merge back + * the slices into the original region if there is no reason to + * keep those. + */ + if (!orig_region || orig_end_addr <=3D r->ar.start) { + orig_region =3D r; + orig_end_addr =3D r->ar.end; + } + damon_do_apply_schemes(c, t, r); + if (r =3D=3D orig_region) + continue; + /* + * If no scheme was applied to the sliced region, the age of + * the slice ain't be reset. Don't merge that back. + * Otherwise, the monitored information of the region is lost. + */ + if (r->age) { + orig_region =3D NULL; + continue; + } + orig_region->ar.end =3D r->ar.end; + damon_destroy_region(r, t); + r =3D orig_region; + } +} + /* * damon_feed_loop_next_input() - get next input to achieve a target score. * @last_input The last input. @@ -2528,7 +2562,6 @@ static void damos_trace_stat(struct damon_ctx *c, str= uct damos *s) static void kdamond_apply_schemes(struct damon_ctx *c) { struct damon_target *t; - struct damon_region *r; struct damos *s; bool has_schemes_to_apply =3D false; =20 @@ -2551,9 +2584,7 @@ static void kdamond_apply_schemes(struct damon_ctx *c) damon_for_each_target(t, c) { if (c->ops.target_valid && c->ops.target_valid(t) =3D=3D false) continue; - - damon_for_each_region(r, t) - damon_do_apply_schemes(c, t, r); + damos_apply_target(c, t); } =20 damon_for_each_scheme(s, c) { --=20 2.47.3 From nobody Sun Jun 14 18:37:22 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 90DBA3D093B; Fri, 10 Apr 2026 14:20:45 +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=1775830845; cv=none; b=fnU+OGBylIiG1a1KyizxyO3Sv6zBTHygdvpObEwdgRzTPlp4FonrKmOGzGSIo9iDz0IoC/LoaBcKIfWTqjMjX1bFF4dWgAl08YgtjWyVcsE8OLd7AsfbnHNimEWBNNGlmjOfg5gu2a3ZulfMlS1Cy9EnWpgCd7oY+V7CtuXh95c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775830845; c=relaxed/simple; bh=UXAPF6g5HmLPcR+NX9wWokbltFyqLM2XHmtP9qYo8uk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dE7BFFFwS9QmoPfjcLYNxxkcm6b50Sp1bnBz0srjD9a1CZVeCGSP+ipLW8XvKKMSC17TXTw7o0KLFHw9pIatZIELH+wN+XP5yqcKJhJT6AT/OdwYjEmCnDAdP3AmCSKbEKG0e/MYBzV5MlcEv27Qxz8deAfe0SfLsDGhg/4LnWA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=KT/qKC1E; 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="KT/qKC1E" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4841EC19421; Fri, 10 Apr 2026 14:20:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775830845; bh=UXAPF6g5HmLPcR+NX9wWokbltFyqLM2XHmtP9qYo8uk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KT/qKC1EdgmNF/OypCa4cBbTyHfxYQKJqufzo2eY9EkfjLj/N9/9UlQrya7Y3Kfjs v1xyTg9phwjD5maLmTnvBDx/w0Z1c+p6xx9LIZdZvUXG7vQT8x/2xUsPdWN5TDAP9u cEHD+meJTxI1VTRC1H1uj9xKorZ/lZg4RyWWwwK6wvQPEDQs2uDLtMU1i7UWCsqtv1 HM0tc1idJo1ovlBgDDUAFGEcFdpedpUY6D5SHRmk83DK70Y8pvsURDaVPFf1nh1ZkK MhfysZJ3UqL857JlOLwz9sIydBhNaWPARYYUtKdtUG00iBTPYVzgvrX+IVTq4LJxSy 7nSuz0wmY0fkw== 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 v5 03/11] mm/damon/core: introduce failed region quota charge ratio Date: Fri, 10 Apr 2026 07:20:24 -0700 Message-ID: <20260410142034.83798-4-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260410142034.83798-1-sj@kernel.org> References: <20260410142034.83798-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" DAMOS quota is charged to all DAMOS action application attempted memory, regardless of how much of the memory the action was successful and failed. This makes understanding quota behavior without DAMOS stat but only with end level metrics (e.g., increased amount of free memory for DAMOS_PAGEOUT action) difficult. Also, charging action-failed memory same as action-successful memory is somewhat unfair, as successful action application will induce more overhead in most cases. Introduce DAMON core API for setting the charge ratio for such action-failed memory. It allows API callers to specify the ratio in a flexible way, by setting the numerator and the denominator. Signed-off-by: SeongJae Park --- include/linux/damon.h | 9 +++++++++ mm/damon/core.c | 21 ++++++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/include/linux/damon.h b/include/linux/damon.h index d3054af1d964f..5fb1dc585658b 100644 --- a/include/linux/damon.h +++ b/include/linux/damon.h @@ -235,6 +235,8 @@ enum damos_quota_goal_tuner { * @goals: Head of quota tuning goals (&damos_quota_goal) list. * @goal_tuner: Goal-based @esz tuning algorithm to use. * @esz: Effective size quota in bytes. + * @fail_charge_num: Failed regions charge rate numerator. + * @fail_charge_denom: Failed regions charge rate denominator. * * @weight_sz: Weight of the region's size for prioritization. * @weight_nr_accesses: Weight of the region's nr_accesses for prioritizat= ion. @@ -264,6 +266,10 @@ enum damos_quota_goal_tuner { * * The resulting effective size quota in bytes is set to @esz. * + * For DAMOS action applying failed amount of regions, charging those same= to + * those that the action has successfully applied may be unfair. For the + * reason, 'the size * @fail_charge_num / @fail_charge_denom' is charged. + * * For selecting regions within the quota, DAMON prioritizes current schem= e's * target memory regions using the &struct damon_operations->get_scheme_sc= ore. * You could customize the prioritization logic by setting &weight_sz, @@ -278,6 +284,9 @@ struct damos_quota { enum damos_quota_goal_tuner goal_tuner; unsigned long esz; =20 + unsigned int fail_charge_num; + unsigned int fail_charge_denom; + unsigned int weight_sz; unsigned int weight_nr_accesses; unsigned int weight_age; diff --git a/mm/damon/core.c b/mm/damon/core.c index b0f673efc53c8..f93f107bfb9ec 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -918,6 +918,8 @@ static int damos_commit_quota(struct damos_quota *dst, = struct damos_quota *src) if (err) return err; dst->goal_tuner =3D src->goal_tuner; + dst->fail_charge_num =3D src->fail_charge_num; + dst->fail_charge_denom =3D src->fail_charge_denom; dst->weight_sz =3D src->weight_sz; dst->weight_nr_accesses =3D src->weight_nr_accesses; dst->weight_age =3D src->weight_age; @@ -2042,6 +2044,23 @@ static void damos_walk_cancel(struct damon_ctx *ctx) mutex_unlock(&ctx->walk_control_lock); } =20 +static void damos_charge_quota(struct damos_quota *quota, + unsigned long sz_region, unsigned long sz_applied) +{ + /* + * sz_applied could be bigger than sz_region, depending on ops + * implementation of the action, e.g., damos_pa_pageout(). Charge only + * the region size in the case. + */ + if (!quota->fail_charge_denom || sz_applied > sz_region) + quota->charged_sz +=3D sz_region; + else + quota->charged_sz +=3D sz_applied + mult_frac( + (sz_region - sz_applied), + quota->fail_charge_num, + quota->fail_charge_denom); +} + static bool damos_quota_is_full(struct damos_quota *quota, unsigned long min_region_sz) { @@ -2112,7 +2131,7 @@ static void damos_apply_scheme(struct damon_ctx *c, s= truct damon_target *t, ktime_get_coarse_ts64(&end); quota->total_charged_ns +=3D timespec64_to_ns(&end) - timespec64_to_ns(&begin); - quota->charged_sz +=3D sz; + damos_charge_quota(quota, sz, sz_applied); if (damos_quota_is_full(quota, c->min_region_sz)) { quota->charge_target_from =3D t; quota->charge_addr_from =3D r->ar.end + 1; --=20 2.47.3 From nobody Sun Jun 14 18:37:22 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 EE4B83D170C; Fri, 10 Apr 2026 14:20:45 +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=1775830846; cv=none; b=V4wpum2rP0SkbJp1KT8knRx8SgFYyqQdE/8nUUYohnmYcX3fpICgx7DorNj62VSnhM58eT7EX2RdJO6rPopUFg877rK3OgWhl+mfw6TJ/UaBSMkF3PL92iuaMJfE7yyD9fD8ayjemn9zlnlmiLmL9fh9RCY2sH4JnOlWyOGJp4c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775830846; c=relaxed/simple; bh=sGB3rlU6Wo00dN98XUbINMBktp7aAzb0KnYDPk0v+Qg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KfXaDmvyA4n3NJZtJ1sqNZS2e6OYdDSm0qKc8Jy9arCM7DhCbxu48wqS/zB4VGxsMAFsjCmd/7ZkSi7Vju3rGJuiGEg0mntea9luj8FZpUcQFlJauBSGWzUQiNNQTTOGM3OneoFhlPUlXIehhiYRLrucmVGF7LjG7Q+mfAE76Fw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=SrMOdejW; 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="SrMOdejW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9F9C6C2BC9E; Fri, 10 Apr 2026 14:20:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775830845; bh=sGB3rlU6Wo00dN98XUbINMBktp7aAzb0KnYDPk0v+Qg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SrMOdejWtVnL+yvD2N2HQfsDXNP/XXaxfJjFNfkoU6pptbD9RwZfrVa6r1mBaXO0L gNohPfrPbU4RvIRh57DeB80OVMRQEmTT/Fgw8QqQbKDIrw2+vIRvEkEbpzrcanSFtr 7isJB0XeRROzNAfD6k/baja3hmIjuqdz1t9moNX7z22rdsOHKkAmKasktO4WSXXK2u piPGY+BnUPubXbLSG5pp/to8mLsAjkpUKWgbsceHySYuPupzBU1abU6iPn0w8PACq9 k38tZtHrC6TTpu1b41qWNdP4oMYb9Hb0s/CO6coRqRSR19MYXWJ3006ois0k4idBIx mrHc6+CGVYCTA== 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 v5 04/11] mm/damon/sysfs-schemes: implement fail_charge_{num,denom} files Date: Fri, 10 Apr 2026 07:20:25 -0700 Message-ID: <20260410142034.83798-5-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260410142034.83798-1-sj@kernel.org> References: <20260410142034.83798-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" Implement the user-space ABI for the DAMOS action failed region quota-charge ratio setup. For this, add two new sysfs files under the DAMON sysfs interface for DAMOS quotas. Names of the files are fail_charge_num and fail_charge_denom, and work for reading and setting the numerator and denominator of the failed regions charge ratio. Signed-off-by: SeongJae Park --- mm/damon/sysfs-schemes.c | 54 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/mm/damon/sysfs-schemes.c b/mm/damon/sysfs-schemes.c index aa08a8f885fb0..edec3566bcd11 100644 --- a/mm/damon/sysfs-schemes.c +++ b/mm/damon/sysfs-schemes.c @@ -1489,6 +1489,8 @@ struct damon_sysfs_quotas { unsigned long reset_interval_ms; unsigned long effective_sz; /* Effective size quota in bytes */ enum damos_quota_goal_tuner goal_tuner; + unsigned int fail_charge_num; + unsigned int fail_charge_denom; }; =20 static struct damon_sysfs_quotas *damon_sysfs_quotas_alloc(void) @@ -1663,6 +1665,48 @@ static ssize_t goal_tuner_store(struct kobject *kobj, return -EINVAL; } =20 +static ssize_t fail_charge_num_show(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) +{ + struct damon_sysfs_quotas *quotas =3D container_of(kobj, + struct damon_sysfs_quotas, kobj); + + return sysfs_emit(buf, "%u\n", quotas->fail_charge_num); +} + +static ssize_t fail_charge_num_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 err =3D kstrtouint(buf, 0, "as->fail_charge_num); + + if (err) + return -EINVAL; + return count; +} + +static ssize_t fail_charge_denom_show(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) +{ + struct damon_sysfs_quotas *quotas =3D container_of(kobj, + struct damon_sysfs_quotas, kobj); + + return sysfs_emit(buf, "%u\n", quotas->fail_charge_denom); +} + +static ssize_t fail_charge_denom_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 err =3D kstrtouint(buf, 0, "as->fail_charge_denom); + + if (err) + return -EINVAL; + return count; +} + static void damon_sysfs_quotas_release(struct kobject *kobj) { kfree(container_of(kobj, struct damon_sysfs_quotas, kobj)); @@ -1683,12 +1727,20 @@ static struct kobj_attribute damon_sysfs_quotas_eff= ective_bytes_attr =3D static struct kobj_attribute damon_sysfs_quotas_goal_tuner_attr =3D __ATTR_RW_MODE(goal_tuner, 0600); =20 +static struct kobj_attribute damon_sysfs_quotas_fail_charge_num_attr =3D + __ATTR_RW_MODE(fail_charge_num, 0600); + +static struct kobj_attribute damon_sysfs_quotas_fail_charge_denom_attr =3D + __ATTR_RW_MODE(fail_charge_denom, 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, + &damon_sysfs_quotas_fail_charge_num_attr.attr, + &damon_sysfs_quotas_fail_charge_denom_attr.attr, NULL, }; ATTRIBUTE_GROUPS(damon_sysfs_quotas); @@ -2780,6 +2832,8 @@ static struct damos *damon_sysfs_mk_scheme( .weight_nr_accesses =3D sysfs_weights->nr_accesses, .weight_age =3D sysfs_weights->age, .goal_tuner =3D sysfs_quotas->goal_tuner, + .fail_charge_num =3D sysfs_quotas->fail_charge_num, + .fail_charge_denom =3D sysfs_quotas->fail_charge_denom, }; struct damos_watermarks wmarks =3D { .metric =3D sysfs_wmarks->metric, --=20 2.47.3 From nobody Sun Jun 14 18:37:22 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 BC4193D332E; Fri, 10 Apr 2026 14:20:46 +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=1775830846; cv=none; b=GvRnR1gpjZrFkq7K00Ro7XDNC5tW46clBfGoy9wqJ+Cl1uo2ctHekMtwv/jiHovIRhJXwwI7voxXT80X8F2d3vNSsEX0lJEC7x30C4EcFpEvPDzbXOFsUc9kyR7YWf9erdufDo+udLfAh414zD/AudbbNGZNmwr8hZtIjas8uMk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775830846; c=relaxed/simple; bh=x42u0yyujS0MNNJ5zIzlJ5WzcqjchBB5xjDhcoIlpNo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UR2CZ/oagHScJ1UiPJUkYlgzpwItaJTG7eWat9lA6kxAy9xki8pfsS6TcytYYcBf9iRlyaKtKOtPNRGH/W+b3MjJ7UWqkSvcYNdlx4ylWDrRo0FUXp6BW18zg0tS2oTQAWV1ipLSpRE4WtEqL4/GCEIgvPNi9IvZ1nH2GLvBXG0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=AK4nbONb; 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="AK4nbONb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 013D8C2BC87; Fri, 10 Apr 2026 14:20:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775830846; bh=x42u0yyujS0MNNJ5zIzlJ5WzcqjchBB5xjDhcoIlpNo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AK4nbONbQb0eDIAbPTFWIGS7EmMnpU8NyFvBqyYlR77VQbb4whGmlf2GTSs/eoioc 8GmVmKGNwLdqZzBQSJk+/Wo03tVz09ZqiyzRTw4xe0LzyRqHx48YSUl86C1Kkr0/d0 hvDULEf8n/qQMEk6X/ob+4cfVK8MimyqHgv2ZsW2Vg1vezVGyZx3RGajYE023NwZVS cc45eDOjjlG0EyBughQXD8UDMT3TN7YxPBIKukMdx796lochqj8tSJ88nGpbeb10S3 Esxyh1Kqi+T5hodbvor0MwQa9aTj65SNu7376Nj8Bl1cSI9fnV7vtjwGrdjfeXdqRE TuvlKRz29LSVQ== 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 v5 05/11] Docs/mm/damon/design: document fail_charge_{num,denom} Date: Fri, 10 Apr 2026 07:20:26 -0700 Message-ID: <20260410142034.83798-6-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260410142034.83798-1-sj@kernel.org> References: <20260410142034.83798-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 DAMON design document for the DAMOS action failed region quota charge ratio. Signed-off-by: SeongJae Park --- Documentation/mm/damon/design.rst | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Documentation/mm/damon/design.rst b/Documentation/mm/damon/des= ign.rst index 622d24e35961e..fa7392b5a331d 100644 --- a/Documentation/mm/damon/design.rst +++ b/Documentation/mm/damon/design.rst @@ -576,6 +576,28 @@ interface `, refer to :ref:`weights <= sysfs_quotas>` part of the documentation. =20 =20 +.. _damon_design_damos_quotas_failed_memory_charging_ratio: + +Action-failed Memory Charging Ratio +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +DAMOS action to a given region can fail for some subsets of the memory of = the +region. For example, if the action is ``pageout`` and the region has some +unreclaimable pages, applying the action to the pages will fail. The amou= nt of +system resource that is taken for such failed action applications is usual= ly +different from that for successful action applications. For such cases, u= sers +can set different charging ratio for such failed memory. The ratio can be +specified using ``fail_charge_num`` and ``fail_charge_denom`` parameters. = The +two parameters represent the numerator and denominator of the ratio. The +feature is enabled only if ``fail_charge_denom`` is not zero. + +For example, let's suppose a DAMOS action is applied to a region of 1,000 = MiB +size. The action is successfully applied to only 700 MiB of the region. +``fail_charge_num`` and ``fail_charge_denom`` are set to ``1`` and ``1024`= `, +respectively. Then only 700 MiB and 300 KiB of size (``700 MiB + 300 MiB = * 1 / +1024``) will be charged. + + .. _damon_design_damos_quotas_auto_tuning: =20 Aim-oriented Feedback-driven Auto-tuning --=20 2.47.3 From nobody Sun Jun 14 18:37:22 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 AEB193CEB94; Fri, 10 Apr 2026 14:20:47 +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=1775830847; cv=none; b=AncqEOBdx6MB5Z8TPZZT2xIOIju/l/F79sC1aGQDOBAeVP/Yx/5xqiWlyxG6GfeX9nllyOCE7YibYPqNG5ImeLmrbkRC/2Bk02K06G9aBjjAE2eFoOMH2hpX2/RnSgi7/EbmUkNISQ6QLOj5Y4yAN7qF6hD2wwwvs5pCVG9UmQA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775830847; c=relaxed/simple; bh=fJkIAWWlo48QPdeJ9YXUoXHCIlYHiM9shoj6TYfrLSQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=cF8wxS57qtOTueEsw47CADhFPnVLpu8IsZFT24k/w56rbs8zE3Y8VtoIho4x6MQmHCt3nKEBI2ytBsj3KjcKXevULOKA/oZaw5c/PGZdmp8THYf9uoiY2rzpA6sUfZWKelNOBdGZmx9l6vaOeoMavB2IscWlIeK39GmCBXPYiD4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=fFKB4S9p; 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="fFKB4S9p" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A766CC2BCB2; Fri, 10 Apr 2026 14:20:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775830847; bh=fJkIAWWlo48QPdeJ9YXUoXHCIlYHiM9shoj6TYfrLSQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fFKB4S9pndS8ojZKsfjMcXM27eJslDp78XHI0NS9OmbQ7O7I1QKrZqF/45Re8ylEg SQQxR6sGPFkloqKDy4nX3Nr/Um8QPprePEAvQgQ4DIVuyGzNPF4B6z2PCeQvO4BhcV 2VzoRVluXQ6jSkSzftsAjr4egOXBj/HQM6Fq0nCy+A5WdFTsoortEpxVxcmiqAd6zq xSpN9liedp1cllTnDxF2fk7CcIqexh+Nx/AgziEvYnA2YGbiTEH1wn2kW6ScmYG+X/ 5ZmAaw2unrc42cMKZdiAegmpmGfeG1uUyBA7ke6AFweWGzQo8CCvxZxHoK66sNZeZP VGpzA617ljYIw== 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 v5 06/11] Docs/admin-guide/mm/damon/usage: document fail_charge_{num,denom} files Date: Fri, 10 Apr 2026 07:20:27 -0700 Message-ID: <20260410142034.83798-7-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260410142034.83798-1-sj@kernel.org> References: <20260410142034.83798-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 DAMON usage document for the DAMOS action failed regions quota charge ratio control sysfs files. Signed-off-by: SeongJae Park --- Documentation/admin-guide/mm/damon/usage.rst | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/Documentation/admin-guide/mm/damon/usage.rst b/Documentation/a= dmin-guide/mm/damon/usage.rst index bfdb717441f05..d5548e460857c 100644 --- a/Documentation/admin-guide/mm/damon/usage.rst +++ b/Documentation/admin-guide/mm/damon/usage.rst @@ -84,7 +84,9 @@ 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,goa= l_tuner + =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, + =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 = effective_bytes,goal_tuner, + =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 = fail_charge_num,fail_charge_denom =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 @@ -381,9 +383,10 @@ schemes//quotas/ The directory for the :ref:`quotas ` of the giv= en DAMON-based operation scheme. =20 -Under ``quotas`` directory, five files (``ms``, ``bytes``, -``reset_interval_ms``, ``effective_bytes`` and ``goal_tuner``) and two -directories (``weights`` and ``goals``) exist. +Under ``quotas`` directory, seven files (``ms``, ``bytes``, +``reset_interval_ms``, ``effective_bytes``, ``goal_tuner``, ``fail_charge_= num`` +and ``fail_charge_denom``) 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, @@ -402,6 +405,13 @@ the background design of the feature and the name of t= he selectable algorithms. Refer to :ref:`goals directory ` for the goals setup. =20 +You can set the action-failed memory quota charging ratio by writing the +numerator and the denominator for the ratio to ``fail_charge_num`` and +``fail_charge_denom`` files, respectively. Reading those files will retur= n the +current set values. Refer to :ref:`design +` for more details= of +the ratio feature. + 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 Sun Jun 14 18:37:22 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 AEBBA3CFF4C; Fri, 10 Apr 2026 14:20:47 +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=1775830847; cv=none; b=HCAxbkXCh88ZvKBjp5T8PQPfe85ygoDGTO2q4OZOJawaLNpK0QvsLYC8/iy1x5Lpv2OY8NmEzN12F7APKCSYFvOgGYqJQ4/+YczNX0brmuwXDJ6cmpvs31pGxr65QTEuolHg3cnLaPgXauGgxkLuOVJ9MxThO6E1bc+EDwKqqX4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775830847; c=relaxed/simple; bh=WgiRHi50zFvHwjFSQiNfyV/FQHY8WOkdhFM9Jv3jqj0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gLZxWaUkn67wFxg9njN+CRQMbqaOQS+u8KWiVXNs/j6MMufBh6aQ7bhlJ986pll9UghRNFOV0D2RuP7i028BjYauaduqabvO1Xd/BIaZ15+oKjcoEus3te/iYV4aWjqosQ1USMM6AfVOkDiobLGOBddDz2ooDcXofPZSjLOKI2k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Z4/gqIUK; 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="Z4/gqIUK" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56FCDC2BCB4; Fri, 10 Apr 2026 14:20:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775830847; bh=WgiRHi50zFvHwjFSQiNfyV/FQHY8WOkdhFM9Jv3jqj0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z4/gqIUKxFf4YuHCdqto6uMxZfyyhS3umIa9Iz44XQ05dv1Xg0RTuCESmCGxkwMY6 mRdg7hZoUXHRhOjZnzjU6Z9QxK+JqhGEF5R/4LEtv1xJzEr32A2Y5MkmLKk0cp/7cW ivKp6RzzkDYLSTgwGWA5U4/kx5udT2/S5QuOm6rFt0TSUil1oZwojytp2HVl9siz8q F4nf9HHv1BVMdUf7IcMAo6/8twZzDlN54T8JeCNGd8horj2976LWFra/rZP6N7UMNJ MRx/t7LHwtKVIzzsQKrqsD7K+9gOh4MTYfp0ehGWB2+mFRhtyiGupZ5UBB9zqVmzZs qNkBFJUrTHdvA== From: SeongJae Park To: Cc: SeongJae Park , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH v5 07/11] Docs/ABI/damon: document fail_charge_{num,denom} Date: Fri, 10 Apr 2026 07:20:28 -0700 Message-ID: <20260410142034.83798-8-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260410142034.83798-1-sj@kernel.org> References: <20260410142034.83798-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 DAMON ABI document for the DAMOS action failed regions quota charge ratio control sysfs files. Signed-off-by: SeongJae Park --- Documentation/ABI/testing/sysfs-kernel-mm-damon | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-kernel-mm-damon b/Documentatio= n/ABI/testing/sysfs-kernel-mm-damon index 7059f540940f0..971c22e34e722 100644 --- a/Documentation/ABI/testing/sysfs-kernel-mm-damon +++ b/Documentation/ABI/testing/sysfs-kernel-mm-damon @@ -329,6 +329,18 @@ Contact: SeongJae Park Description: Writing to and reading from this file sets and gets the goal-based effective quota auto-tuning algorithm to use. =20 +What: /sys/kernel/mm/damon/admin/kdamonds//contexts//schemes//qu= otas/fail_charge_num +Date: Mar 2026 +Contact: SeongJae Park +Description: Writing to and reading from this file sets and gets the + action-failed memory quota charging ratio numerator. + +What: /sys/kernel/mm/damon/admin/kdamonds//contexts//schemes//qu= otas/fail_charge_denom +Date: Mar 2026 +Contact: SeongJae Park +Description: Writing to and reading from this file sets and gets the + action-failed memory quota charging ratio denominator. + 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 Sun Jun 14 18:37:22 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 20A193D3D19; Fri, 10 Apr 2026 14:20:48 +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=1775830848; cv=none; b=g7pu/Hz0sQN/8LjLC2jVWQnBqcP1BqhJ0dxm6i1vll2pDz63YcTeh+cF4GbNubt2e/sQdYvt/47PaBFtiPE1zEZdEuijhOmHohXMONn9529OBVw0Z9b42kp7gq1LYKcNliliMenlPYB5DXmqzvUfkp487u8RVbmQNsauIuMLOuQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775830848; c=relaxed/simple; bh=oBXW5uIN8lzshHczxlHFHeX8VLmiX/5T2Hz8N+WZ/sY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qJCudIp3wP5sg+it5X/U3cwibw+z9NOB+78paEOpGxugLOEWYfEUfAb1iyxPA8HMLIjflUWWkPeshNWijgYl62hadXCwPsqQXkr2QOMFpo+Lvz3Y76XvGCHRFb7r3CHd8DHY7vonNiFfmmlfOEV91M93uD4PyMmpyHATM8PnNfQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=HwVHDgR6; 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="HwVHDgR6" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A09F2C19421; Fri, 10 Apr 2026 14:20:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775830847; bh=oBXW5uIN8lzshHczxlHFHeX8VLmiX/5T2Hz8N+WZ/sY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HwVHDgR6EL7sgMIXcHCBMmFmJ6erdjL60dPRizRABv0CcjtOOuk/gfNy3QPZzkDZz 2dQcvYmokpHQ/ug7alVYo2LgaLmetwmA9aQ1NxW/mzdCdqfhwCFWuTFDqKPrazEFlz LwwaBR25VXA2YKVRfotLF+8KM5Ltgt/4vIR4oovDGaVJzHSF2jgg5I+P+wzrB8Klp3 ojrKNihjZgm2S9KYK8wm81cUuNftlIbMDwgWWJaJOYsXucpKKquRoHHgJlnvDa0hFL m7aFC8Yui8oQyXkA4tsW9mWhr2dx4OP3mratBwo2eRGYvtElZuE+F5/IzG+z4ZMfZa YcNPbDBh/wqoQ== From: SeongJae Park To: Cc: SeongJae Park , Andrew Morton , Brendan Higgins , David Gow , damon@lists.linux.dev, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH v5 08/11] mm/damon/tests/core-kunit: test fail_charge_{num,denom} committing Date: Fri, 10 Apr 2026 07:20:29 -0700 Message-ID: <20260410142034.83798-9-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260410142034.83798-1-sj@kernel.org> References: <20260410142034.83798-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 damos_test_commit_quotas() kunit test to ensure damos_commit_quota() handles fail_charge_{num,denom} parameters. Signed-off-by: SeongJae Park --- mm/damon/tests/core-kunit.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mm/damon/tests/core-kunit.h b/mm/damon/tests/core-kunit.h index 0030f682b23b7..1b23a22ac04c4 100644 --- a/mm/damon/tests/core-kunit.h +++ b/mm/damon/tests/core-kunit.h @@ -694,6 +694,8 @@ static void damos_test_commit_quota(struct kunit *test) .ms =3D 2, .sz =3D 3, .goal_tuner =3D DAMOS_QUOTA_GOAL_TUNER_CONSIST, + .fail_charge_num =3D 2, + .fail_charge_denom =3D 3, .weight_sz =3D 4, .weight_nr_accesses =3D 5, .weight_age =3D 6, @@ -703,6 +705,8 @@ static void damos_test_commit_quota(struct kunit *test) .ms =3D 8, .sz =3D 9, .goal_tuner =3D DAMOS_QUOTA_GOAL_TUNER_TEMPORAL, + .fail_charge_num =3D 1, + .fail_charge_denom =3D 1024, .weight_sz =3D 10, .weight_nr_accesses =3D 11, .weight_age =3D 12, @@ -717,6 +721,8 @@ static void damos_test_commit_quota(struct kunit *test) KUNIT_EXPECT_EQ(test, dst.ms, src.ms); KUNIT_EXPECT_EQ(test, dst.sz, src.sz); KUNIT_EXPECT_EQ(test, dst.goal_tuner, src.goal_tuner); + KUNIT_EXPECT_EQ(test, dst.fail_charge_num, src.fail_charge_num); + KUNIT_EXPECT_EQ(test, dst.fail_charge_denom, src.fail_charge_denom); KUNIT_EXPECT_EQ(test, dst.weight_sz, src.weight_sz); KUNIT_EXPECT_EQ(test, dst.weight_nr_accesses, src.weight_nr_accesses); KUNIT_EXPECT_EQ(test, dst.weight_age, src.weight_age); --=20 2.47.3 From nobody Sun Jun 14 18:37:22 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 76D603D412F; Fri, 10 Apr 2026 14:20:48 +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=1775830848; cv=none; b=uG0HZvOSuHPc1rfLER2uNPBzgI2DeJU0t/O6FSe46gvNeMHLIERCHTk/bLd+mXejoeDJvv5IsZhBkbqLH5gXOSN4elad6QZFAbVYmsur+8w75rl9cOb7P0nBLTHdjcpGHMGzLkVeekOb6CmhxW23O5d2X+AINWhHkIn9WKKXXVo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775830848; c=relaxed/simple; bh=EIRB4p0R7OQMpXCAySjtmt5LRqO984ojhpZfxIiXyb0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gOpGYavYVIC3igsyyae7BSg1Mv3TZ2TALizsKBXtIWE+tjdANWeg7PWt9+5CJ3nFXZ1UFmKO/2IMQPmRLWm63QkLK9ZEySomHIHG0LkiHspJGpRdSG3sVhbcR08fMG16tzYyxhktWg7rJ2wBxU5IO9NzLkyxtptfiVcGlTvP+XA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=H3TTDrut; 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="H3TTDrut" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1CB63C2BC87; Fri, 10 Apr 2026 14:20:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775830848; bh=EIRB4p0R7OQMpXCAySjtmt5LRqO984ojhpZfxIiXyb0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H3TTDrut21lQwelyoOsxr4x9Ax6qMNVkHfGGpdRnFUGPFmaIeguWdPUSjxh3us7jF aITW0Gui7ZsPNc4f84EOsoepH14JiYzKza7bHKoXqdQ/W7G0TfFgScJjAuk+fRnhDb Ke2k+LJrPwX+kLRZya44tN8KsWzp8ADaawjCxQg1APcDsl8Ukjw2ddsU2k/YRY4nCg wvJ5mgEaS/HhCf8D1LXRSEp7D7lu2dxF+yXMMgAekt3k9v9cJUuC5sWcsjs1W9h5M3 JXNQL5LxFXUEnSg8PLKLTip+zjdDMoM9UtWmVzXjDk6sHv7cesXqo0GJ+b3v/5uFuS /+HeFpCEwxEnw== 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 v5 09/11] selftests/damon/_damon_sysfs: support failed region quota charge ratio Date: Fri, 10 Apr 2026 07:20:30 -0700 Message-ID: <20260410142034.83798-10-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260410142034.83798-1-sj@kernel.org> References: <20260410142034.83798-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 _damon_sysfs.py for DAMOS action failed regions quota charge ratio setup, so that we can add kselftest for the new feature. Signed-off-by: SeongJae Park --- tools/testing/selftests/damon/_damon_sysfs.py | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/damon/_damon_sysfs.py b/tools/testing/= selftests/damon/_damon_sysfs.py index 120b96ecbd741..8b12cc0484405 100644 --- a/tools/testing/selftests/damon/_damon_sysfs.py +++ b/tools/testing/selftests/damon/_damon_sysfs.py @@ -132,14 +132,17 @@ class DamosQuota: goals =3D None # quota goals goal_tuner =3D None # quota goal tuner reset_interval_ms =3D None # quota reset interval + fail_charge_num =3D None + fail_charge_denom =3D None 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, goal_tuner=3D'consist= ', - reset_interval_ms=3D0, weight_sz_permil=3D0, - weight_nr_accesses_permil=3D0, weight_age_permil=3D0): + reset_interval_ms=3D0, fail_charge_num=3D0, fail_charge_d= enom=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 @@ -151,6 +154,8 @@ class DamosQuota: for idx, goal in enumerate(self.goals): goal.idx =3D idx goal.quota =3D self + self.fail_charge_num =3D fail_charge_num + self.fail_charge_denom =3D fail_charge_denom =20 def sysfs_dir(self): return os.path.join(self.scheme.sysfs_dir(), 'quotas') @@ -197,6 +202,18 @@ class DamosQuota: os.path.join(self.sysfs_dir(), 'goal_tuner'), self.goal_tu= ner) if err is not None: return err + + err =3D write_file( + os.path.join(self.sysfs_dir(), 'fail_charge_num'), + self.fail_charge_num) + if err is not None: + return err + err =3D write_file( + os.path.join(self.sysfs_dir(), 'fail_charge_denom'), + self.fail_charge_denom) + if err is not None: + return err + return None =20 class DamosWatermarks: --=20 2.47.3 From nobody Sun Jun 14 18:37:22 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 C0FAB3D47C4; Fri, 10 Apr 2026 14:20:48 +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=1775830848; cv=none; b=hyt62FCTm1BIXCbbUU0iNpr9jxPVos3qidyXsAPH17gJOHWb3FoVWfKouRM2HqaWLTn7ZqDiRnMQtk4rQoxqnyvE9+/cNvCWNOhjMVqIpIizp5cfHbXO8WTku2zCVtIZwJkO0GsnsNgj60DHRn/XL7MyijDjTGq8LYfqAY2zLq8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775830848; c=relaxed/simple; bh=EuOHul4fripHvwsgWhBfbomSmWCRXpHL6QQJMWdANgQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SE8+H3+L6T9sPyrMmsgE5euA8kB+EQR/4EXQEpGEZ1f8n46zsIg8OcRuPFrGnjLUYPUmEL709YLx4XXuYgZj/7oklN68KI+hGXiTv0DFeDcWdHYwdCLIwRnzszKO9rYxmSM+4mIIQ1iXseB9wqUipeFPvyVX7J6X459JbYxp73U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VuGsGZkb; 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="VuGsGZkb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74922C4AF0B; Fri, 10 Apr 2026 14:20:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775830848; bh=EuOHul4fripHvwsgWhBfbomSmWCRXpHL6QQJMWdANgQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VuGsGZkbe1hyR3qzbqlU38ZYoXwXJoT4kYB4ZCGYtauU1lIdqm80Tjr1DWCcZcd7T fHwb4PVQO+JW+f2fNJbJjlnHTQuyd0RbQONudS7qTdZgo7hc3fr3j+ak6bYW/iSpE0 5V0/Xo1KEAvRTyJHbU0yMQpF0A9qXDIZT0+9Ix2kvTk7nhbas0bVUh9/IVmHxs1c+Y l0b6txmImREDfHCT6qd7r1lBz20A5Thoflf2H15FPLG6ZC9PWxU95tcuFEC7Skflv0 t6T2oaJtGZ896sgU51fhPYMiwoE2oOM18UQPSMY7FuAd46rZSmXUevqvdVbYOb4nm3 wTn77/XW68ZYQ== 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 v5 10/11] selftests/damon/drgn_dump_damon_status: support failed region quota charge ratio Date: Fri, 10 Apr 2026 07:20:31 -0700 Message-ID: <20260410142034.83798-11-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260410142034.83798-1-sj@kernel.org> References: <20260410142034.83798-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 drgn_dump_damon_status.py to dump DAMON internal state for DAMOS action failed regions quota charge ratio, to be able to show if the internal state for the feature is working, with future DAMON selftests. Signed-off-by: SeongJae Park --- tools/testing/selftests/damon/drgn_dump_damon_status.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/testing/selftests/damon/drgn_dump_damon_status.py b/tool= s/testing/selftests/damon/drgn_dump_damon_status.py index 5b90eb8e7ef88..972948e6215f1 100755 --- a/tools/testing/selftests/damon/drgn_dump_damon_status.py +++ b/tools/testing/selftests/damon/drgn_dump_damon_status.py @@ -112,6 +112,8 @@ def damos_quota_to_dict(quota): ['goals', damos_quota_goals_to_list], ['goal_tuner', int], ['esz', int], + ['fail_charge_num', int], + ['fail_charge_denom', int], ['weight_sz', int], ['weight_nr_accesses', int], ['weight_age', int], --=20 2.47.3 From nobody Sun Jun 14 18:37:22 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 53C723D5659; Fri, 10 Apr 2026 14:20:49 +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=1775830849; cv=none; b=TMNItEnR8LksRAn5lEWiVkXZQD1mSF7lpz5PfeUiSfr4pUM7GQAJTk2bPnzTtXy3lW8zNYJi1m0n2b73mXUUN/eTGYDS2kLNyCKVDOdx0Ajydt5SIb1LdGw534xqqQAbYGzF8aEaWvuS4mUZbEg6pF98jdLdBNyVbKsIN7ghPDM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775830849; c=relaxed/simple; bh=t5zJdXrSXfUqeg8E0cFC/+8XELPbXvEetq+3G/tXFao=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dm+bwEgcMibcYzaQhK7TExOqbWGAHqkc1Pl7GM3AwV2n7cFpxMoQHlRGkK3O7z56NwbgTO22T87ZEruFmh7upRtGOYG5P1A+F1d9rx1uBt/+8uaYL/CxYt0f4fXUJrIW5N9B/HkXlaPlcui4qD+2nTU5cbMvOgSLGUt60wHxLnI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=j8rIT6g9; 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="j8rIT6g9" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CB940C2BCB3; Fri, 10 Apr 2026 14:20:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775830849; bh=t5zJdXrSXfUqeg8E0cFC/+8XELPbXvEetq+3G/tXFao=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j8rIT6g9MoC6gWi0YoXdTGZJ+Mj4RyQ2nPugKSU7F4vLAllG9GA18qoRQPjGp0hFM CPa4oNRltpHL31jqq6Q/gNyEvh9DWo9kAQ2gybxgUEyGJR0FmmQxEztoA9tZevMtYC 0zBjKdAdetGEo8Yka41esJRrCdtRETVCmyAjfvosdmmZOXR+JgwtmyN7F2QDt5JFb1 bsUyWjNGlqewo1JdJNtVhwvfjvvz5hI1b8U8FLIXwSDfdvUyNXQ9nIUI1BVPQZ0dW/ +jIwqbi/wFQQQpZVltZo1Qcxc3f/Bwxs8hQWEARwhbhX7m9t/+NtTOlpa0XEdRHtbO bqwxbiW2KL76Q== 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 v5 11/11] selftests/damon/sysfs.py: test failed region quota charge ratio Date: Fri, 10 Apr 2026 07:20:32 -0700 Message-ID: <20260410142034.83798-12-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260410142034.83798-1-sj@kernel.org> References: <20260410142034.83798-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 sysfs.py DAMON selftest to setup DAMOS action failed region quota charge ratio and assert the setup is made into DAMON internal state. Signed-off-by: SeongJae Park --- tools/testing/selftests/damon/sysfs.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/testing/selftests/damon/sysfs.py b/tools/testing/selftes= ts/damon/sysfs.py index 387286dc449d5..cd4d82c852113 100755 --- a/tools/testing/selftests/damon/sysfs.py +++ b/tools/testing/selftests/damon/sysfs.py @@ -73,6 +73,10 @@ def assert_quota_committed(quota, dump): } assert_true(dump['goal_tuner'] =3D=3D tuner_val[quota.goal_tuner], 'goal_tuner', dump) + assert_true(dump['fail_charge_num'] =3D=3D quota.fail_charge_num, + 'fail_charge_num', dump) + assert_true(dump['fail_charge_denom'] =3D=3D quota.fail_charge_denom, + 'fail_charge_denom', 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) @@ -278,6 +282,8 @@ def main(): nid=3D1)], goal_tuner=3D'temporal', reset_interval_ms=3D1500, + fail_charge_num=3D1, + fail_charge_denom=3D4096, weight_sz_permil=3D20, weight_nr_accesses_permil=3D200, weight_age_permil=3D1000), --=20 2.47.3