From nobody Sat Jun 20 17:31:34 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 398A819D065; Sun, 12 Apr 2026 16:20:02 +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=1776010802; cv=none; b=WJZLGO8DvtC1n+CwjUZTTwLoSZZt87nBoJ7RaoosrQ1noHPvYwQTbD2ooGYuMuHIAlJBynk6/T/0ReBv21nlnu3KA812buFuf/nXOF9/gw80MboHH3JZodZ3IgfnUXIfFpykQT51xS4lIwFqCdnqbOZgIDuzKK2jrbIfHn03S30= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776010802; c=relaxed/simple; bh=W9Vy1W3vBVeqguIJu3bjj9rtcI+jfN71tbju0b2uI9s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rYi+mc4zMIPi3G2geVgS+fNJzkSggc0d61E09Lgi+r5qXrq89GVFHUzRv9Xl2CXBJvZNKNasRhY+6JBXY6jHGOGwqBJaa+FLNDLreIgJViLufw1SqbcxVcKZQQzXZtiZAMu/DFV5wCQCPtJverJMW1QAsUUzKA+Ge05Y6AYhnGc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=MtxpeDjZ; 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="MtxpeDjZ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E108FC2BCB0; Sun, 12 Apr 2026 16:20:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1776010802; bh=W9Vy1W3vBVeqguIJu3bjj9rtcI+jfN71tbju0b2uI9s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MtxpeDjZw4HqSgjjpahq2DhS+2YQNXFsGCEtpJkEij14DWFlR6N1R4lvqLkoSvuH0 glJG09qAiZcC+CcmNjU7cWR/6iYtJaSM7lG/cssHFZiTKE8jE7cWmhaYYwIcdyfjcX nVuVWX7ELKR/CBj2/dP9+67+ZgKvre34aLYNpPGjxyRPgibnH3lw/wmtzIvwxI4X0J Q6a80TneaCOA8tbQS7FK5yzPmonA/6PaRm4UG4I82cSn6bEJQAFFvVLhAx/hFqW3Xx uh06ICw46NqDII6Gg7p3QxpfuwXr5MVohnJxghin4uD3uLMiWpcIJ3geL33iwwBiaP Ky1puH48j3W4A== 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.2 01/11] mm/damon/core: handle X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260412161957.82835-1-sj@kernel.org> References: <20260412161957.82835-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 a884df98c207a..e6add38e10910 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -2047,6 +2047,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) { @@ -2104,8 +2118,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; } @@ -2133,8 +2146,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)) @@ -2460,8 +2472,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 Sat Jun 20 17:31:34 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 86B5B2BE7BE; Sun, 12 Apr 2026 16:20:02 +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=1776010802; cv=none; b=o5jMhK7nQS82A1H+iLWGZs7Y5lEC0I+6f9eAZd1jGzvvzR5bNIh0NjjLYq07A8RIGWLv7Z3VUbmw6rl/emfgghml/S/nMZrnE1L6NyFF67gJijCv3cjWTf1WFubDiAaf3YyO8yzCvvD6js5mGJQ07XjKB3bDEETu7Ou0Yw/FYCc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776010802; c=relaxed/simple; bh=LcC/dBv1K2/wmpl6p05Sv2infjL4OMvObv2PYe9dyWs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XScgTWVH0T8E3yIBdVDJfCnhjFHvSTez2Lvr1XNBYEdNOTD7UXd/Ba+kRDREu6B204YScVZf3Eod/XtucA6cgpAm8yYFcQ+/L+6r0oE5KwHAxxjBu4ofqekiW8W6zkZdSgZnS65t1KnwheQi4t+ry4z+fAGR37Cu0SocbRBGO9Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gTuuOB1g; 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="gTuuOB1g" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3D60BC19425; Sun, 12 Apr 2026 16:20:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1776010802; bh=LcC/dBv1K2/wmpl6p05Sv2infjL4OMvObv2PYe9dyWs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gTuuOB1g1wJBd2pe5soYlA4/PXz6I6DWXTU7ZPyQcPBxu83TuYXXVHu4AY5NNqHKI vxH+ynQUr8JqSylEF6Joij/tsv5Pts/HV+gX4BwQ57CIszLJ9hhzabqLigh3NXoqVP uDUYsHOo0TkskgWui3/3jN+4h/lWnlmW1JjoGC7BF7Xn4f0HIAt+0gZwVNOfn4yp/y n0r7U3Ee+zCB1BOUWy1NEGYEFeiaL1gTWcb2r9Nz5r6qVqtnUDOgNXTeLJPcIUhhOh 0x2nJ0YSqI6DuQH7eFbhmZJ5KoVNXeQso6h1ESo6sMVTdchiZKZDvcpIIlu3tPawTY 0Ei2oMreIB/yw== 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.2 02/11] mm/damon/core: merge regions after applying DAMOS schemes Date: Sun, 12 Apr 2026 09:19:45 -0700 Message-ID: <20260412161957.82835-3-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260412161957.82835-1-sj@kernel.org> References: <20260412161957.82835-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 while the region to apply the scheme is quite large and the action is nearly always failing, a high number of split operations could happen. Remove the unnecessary overhead by merging regions after applying schemes is done for each region. The merge operation is made only if it will not lose monitoring information and keep min_nr_regions constraint. In the worst case, the max_nr_regions could still be violated until the next per-aggregation interval merge operation is made. Signed-off-by: SeongJae Park --- mm/damon/core.c | 59 +++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 55 insertions(+), 4 deletions(-) diff --git a/mm/damon/core.c b/mm/damon/core.c index e6add38e10910..0654caa904c8c 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -2164,6 +2164,58 @@ static void damon_do_apply_schemes(struct damon_ctx = *c, } } =20 +/* + * damos_apply_target() - Apply DAMOS schemes to a given target. + * @c: monitoring context to apply its DAMOS schemes to.. + * @t: monitoring target to apply the schemes to. + * @max_region_sz: maximum region size for @c. + * + * This function could split regions for keeping the quota. To minimize + * overhead from the split operations increased number of regions, this + * function will also merge regions after the schemes applying attempt is = done, + * for each region. The merge operation is made only when it doesn't lose= the + * monitoring information and not violating @max_region_sz. + * + * Hence, after this function is called, the total number of regions could + * be increased or reduced. The increase could make max_nr_regions tempor= arily + * be violated, until the next per-aggregation interval regions merge oper= ation + * is executed. The decrease will not violate min_nr_regions though, sinc= e it + * keeps @max_region_sz. + */ +static void damos_apply_target(struct damon_ctx *c, struct damon_target *t, + unsigned long max_region_sz) +{ + struct damon_region *r; + + damon_for_each_region(r, t) { + struct damon_region *prev_r; + + damon_do_apply_schemes(c, t, r); + /* + * damon_do_apply_scheems() could split the region for the + * quota. Keeping the new slices is an overhead. Merge back + * the slices into the previous region if it doesn't lose any + * information and not violating the max_region_sz. + */ + if (damon_first_region(t) =3D=3D r) + continue; + prev_r =3D damon_prev_region(r); + if (prev_r->ar.end !=3D r->ar.start) + continue; + if (prev_r->age !=3D r->age) + continue; + if (prev_r->last_nr_accesses !=3D r->last_nr_accesses) + continue; + if (prev_r->nr_accesses !=3D r->nr_accesses) + continue; + if (r->ar.end - prev_r->ar.start > max_region_sz) + continue; + prev_r->ar.end =3D r->ar.end; + damon_destroy_region(r, t); + r =3D prev_r; + } +} + /* * damon_feed_loop_next_input() - get next input to achieve a target score. * @last_input The last input. @@ -2533,9 +2585,9 @@ 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; + unsigned long max_region_sz; =20 damon_for_each_scheme(s, c) { if (time_before(c->passed_sample_intervals, s->next_apply_sis)) @@ -2552,13 +2604,12 @@ static void kdamond_apply_schemes(struct damon_ctx = *c) if (!has_schemes_to_apply) return; =20 + max_region_sz =3D damon_region_sz_limit(c); mutex_lock(&c->walk_control_lock); 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, max_region_sz); } =20 damon_for_each_scheme(s, c) { --=20 2.47.3 From nobody Sat Jun 20 17:31:34 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 D719F2D94BA; Sun, 12 Apr 2026 16:20:02 +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=1776010802; cv=none; b=XID3B91TYv2q2/i31ZJj3tgjiwzCULb50DrPe9FGgtc2nUbkK1ED8xwpAsJz8Ac1ZnIcyIbHbr4+U0az+0bROSRjQuiWyMTX5Q4vubx96Evtigck7W4UDoJrS8cbXYThvrl9vskQsdHXSHs9sYIBytU4Y2ONQDwNAxd0SbfXWR0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776010802; c=relaxed/simple; bh=lVvvJyXXUULYKYNrOl6GeL91WhrIsl7oASNCEnlmdDA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SJgO3QWdlYVR+HhkCLbhNjnD/YlZcDesZI30cRSfZjmIdLtXpM4R2Y0qTgeOjyPmybrSKYBNdnjraZI1AmjVLu4YFYKgkZLRvEt0SicngYpLNtUnXo8Dr1PDmP96gGxez2vc8Q15MQfDjFnWOWd0qU/LZmfZYYwxbdmdkCO0fRQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=FO14dbmL; 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="FO14dbmL" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 915C9C2BCB1; Sun, 12 Apr 2026 16:20:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1776010802; bh=lVvvJyXXUULYKYNrOl6GeL91WhrIsl7oASNCEnlmdDA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FO14dbmLsSeIyks0o1fyBOx0o6ED0i+x/tg7Dv/bLqHGRpVQXmHnigqT572YdYGqR u/jsRXM3ZcRziNURVJb4yzmEcXAELby6RsT8/y0f/8lBYJLmGrObZVp5fLxrOduOKk c1dWf317Foejk2icmKjgb0BBB6iNZWPuJV9SagzZhDhZ3NjQ94tdZcLp9/vLq6M/A5 EdzWESLSBa3e5kZgcHLsFdcjmUFM++iPhHBGiW+kmEUh3M/Wuc/0dRB//qU5cssSuP 4L6ZsbOcXBjwN44Oi4tmkXs+EINs2mn3K91o7CnTX1dAyOwHG4gRIYuYW1SuLeMvGM FW24Mmg6QOt1w== 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.2 03/11] mm/damon/core: introduce failed region quota charge ratio Date: Sun, 12 Apr 2026 09:19:46 -0700 Message-ID: <20260412161957.82835-4-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260412161957.82835-1-sj@kernel.org> References: <20260412161957.82835-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 0654caa904c8c..48633da449104 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; @@ -2047,6 +2049,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) { @@ -2117,7 +2136,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 Sat Jun 20 17:31:34 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 4EEF52DF128; Sun, 12 Apr 2026 16:20:03 +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=1776010803; cv=none; b=aWuSWY/GurNX39TlrK18KiWdizr08kB8Qj+KJoWyCyIopSuzD0EcI/6b1Ty9DAlUY9qtOV5Gkwlp/cH/PAC/50aAG6/NHXFkiZCU6PJg+Pgto++y9Wa+1IgEcIX4wI8ExX/x5iqdwiTSlzGvCB9nrT07qih64WxvKQr5+7cX2Z0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776010803; c=relaxed/simple; bh=sGB3rlU6Wo00dN98XUbINMBktp7aAzb0KnYDPk0v+Qg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Dfg/Q2UtLQ+G3QWH1t7vzvYH+HCka0mXQ2mxhCkja/3YX2wkIYeRy80otBSIK2PrV3N6UyFO7b7XLB3tGPff2sih2kPmi6LPAATPZAO+krTgOYexoP8H2wA7ZbuLff0aVdIKZRIjy+bdd4+n3V7pjOFtSk/BsTTc6FSo2pNv1/4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=c+zSVCZl; 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="c+zSVCZl" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E2385C19425; Sun, 12 Apr 2026 16:20:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1776010803; bh=sGB3rlU6Wo00dN98XUbINMBktp7aAzb0KnYDPk0v+Qg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c+zSVCZlLReom3ZJxDoS2UT18i0y5x4+T8XOYWnWJPU8WtHC5aMsDmE9csTaM7VsF A6hrTlbRzJiUrjavNolZlRgxNa7Zj2me+fxLcABRaQ5HbuN2KPwUSTa756mCcSAAxa k5Wm5wDl6ErTr9sLVJK3213vlQjizxiO3m4ouYBOfZkTzpZtWT6MigJRuQbc6d+PWg wWEGraxCrxTd47NbGdpLjxow1WAMmHPYIAT7rAh70kcZbvgkpQrgBtYx8ICnf3kGy/ 4mUaxdX5zvYoonWpSC6CKwaYmIov5y83CEu3KrP7Ihqm7u0xuRNfLfxDu73ImeDqr5 acKXuTiSvnXtA== 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.2 04/11] mm/damon/sysfs-schemes: implement fail_charge_{num,denom} files Date: Sun, 12 Apr 2026 09:19:47 -0700 Message-ID: <20260412161957.82835-5-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260412161957.82835-1-sj@kernel.org> References: <20260412161957.82835-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 Sat Jun 20 17:31:34 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 E41462F1FC7; Sun, 12 Apr 2026 16:20:03 +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=1776010804; cv=none; b=B/0GKh6XwcHWbm9XjiRhzST3VmLBuJ77NNs6JT70VfEf8ib3gRsM6CFohIa32y0tRtxkHkOTCtbsm9aHhPnicuG8t4Jjhsj8p9pVXGmO+NGHcMZ8aPeS1cf4VSRt3f5m9egM0TUCJwCoyM8UGe4kUGvKErL4C4FlKhOFODM8ZKQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776010804; c=relaxed/simple; bh=x42u0yyujS0MNNJ5zIzlJ5WzcqjchBB5xjDhcoIlpNo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=IGIeRRBGMLDNiydWs1FidVmLhVhpmghPs8TXNcNIdynojXUYti5O6Akh1C5JyG+uaN2hqVbp7F5euGUWkdTgk2fMaIPUjhcbbvSFzTNdZtdSIxbOYT79IbmztA8P9eie0bT/JnlsZG5FXMAOrU0aeadFTjLnkufbPDTSNwUg1A8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=AaBgWyNs; 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="AaBgWyNs" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 40374C2BCB0; Sun, 12 Apr 2026 16:20:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1776010803; bh=x42u0yyujS0MNNJ5zIzlJ5WzcqjchBB5xjDhcoIlpNo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AaBgWyNs0nJ4v872EAZLuHaG0uWbUqGvdCTMDz0tlV8ECu0fvS1XnSqClMa706SpE 1cR0AWCe0uig23iWzz2L20aqpH5+1z6OIbv3sfdNHaEkL/V/0R3lsWcLAq1EqLXA5x sour1JLGYxaOHd3Vd8IE23KNf7XjfXdSr7LibcwEaK2p48Aq9ZD7SER0DL14Cpz8EZ UbMq+K0aCzQGGAsvyXFP5nf3X8CjMyVMGayNQBxfo7BetPG1VGWYJpGayNfOzPbwba 6VdMzOYS9oEx9bQ4nsP/lgQ2os9Yf0XvTHymFcDpOP3Q43EhUNFoURtYTt/TUik8zP XEwX/G9+ult1A== 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.2 05/11] Docs/mm/damon/design: document fail_charge_{num,denom} Date: Sun, 12 Apr 2026 09:19:48 -0700 Message-ID: <20260412161957.82835-6-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260412161957.82835-1-sj@kernel.org> References: <20260412161957.82835-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 Sat Jun 20 17:31:34 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 C14623002A0; Sun, 12 Apr 2026 16:20:04 +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=1776010804; cv=none; b=ovRUPlvfIjMCNR/+Ph1ig4tkPaXdSnHoQ3LlMxuIENAtQbWpV5UiieYQBU6E5mpl8xJkku57BZA1l8r43+UDpeYfvSyJio4G4ldYRxe3cZwGnbr7YnFIxYZkK8Oew2HsXsxRA6/4mNkTKdP55WewknPDNLK4zVA4YgazRp75sA8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776010804; c=relaxed/simple; bh=fJkIAWWlo48QPdeJ9YXUoXHCIlYHiM9shoj6TYfrLSQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=TuZkBsz7WrVcpCpaHFuhyUE8gtnohiCpe6SKJ2JVL2of/bYSFMoZWM/cTyXSNZEo4AfP+izGudB1d4D//7OUX82lUKxWSnXq52g/XrskezYURpZIPUSSfzU0k1Lh47E+/arY2HTguMF/nrUXR2kjIKiKRqr3+mOWRMyDx5iXcBQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ZaD/suMf; 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="ZaD/suMf" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EFE19C2BCB1; Sun, 12 Apr 2026 16:20:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1776010804; bh=fJkIAWWlo48QPdeJ9YXUoXHCIlYHiM9shoj6TYfrLSQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZaD/suMfgoxLCiyEiqO1QSCibvHvDaViwrivuYx68xc/u4fMM8AOReY6rs6EK6yuS EBZ9xtd1ddpYxDHJ8IcDuHGoRr8XptCuIugwnetWeryPu680IC/7xkhVR0x7nbPkdh FSuzjIdXWjQHOmbaZX1NmevXBQq8u5qqBGGI6fTBogrnxkToNLXs7+XEZzHkFZcdDc wyPq0fgstYPZRtQ1UR+2+eeocXrSGBnI/TASn7MzVhpYENg7xug7w0cG9YJG1bJMEn Quo+RRX/B4zNBbLMP8Exvg0F2+fUQjIqcIqPdBCkumMLH2bpa1cQQMjKp6Jex5ogNB hFAgDSHkVb0YA== 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.2 06/11] Docs/admin-guide/mm/damon/usage: document fail_charge_{num,denom} files Date: Sun, 12 Apr 2026 09:19:49 -0700 Message-ID: <20260412161957.82835-7-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260412161957.82835-1-sj@kernel.org> References: <20260412161957.82835-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 Sat Jun 20 17:31:34 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 F0E8A303A0D; Sun, 12 Apr 2026 16:20:04 +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=1776010805; cv=none; b=RUckfaHc2tTc82GAoBZdMEs33De3w1+1B/e/auY+HodufLkgVQ0iZxoX2nOwlCm66JM2ETppkzHZ+XCNoCLrok6I5XwrVhvHtxKi1F/iSIh3zTL8SaXnmu994FuuK5cQdurRfOdRkpizSbNjpNvtfs3vUnrQdNBEE8Jz/tt1WV4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776010805; c=relaxed/simple; bh=WgiRHi50zFvHwjFSQiNfyV/FQHY8WOkdhFM9Jv3jqj0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JdmJhl+hfOTRswCFiEftNAN+Skhjs30i2a4GSHTtYjrcO3EcW2uW1D5EGVIGdP1UetRrpCTFwWbmOSx8kYZtW9662XiX+94Jv6ui0Lu0FOYCx6XBH4CAFL+abmGfQiUg0hWQgNPHElfuKWkSPuOIsKtGEpm+SHJuNb1ofdSbuoY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=go158nx8; 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="go158nx8" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0709C2BCB5; Sun, 12 Apr 2026 16:20:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1776010804; bh=WgiRHi50zFvHwjFSQiNfyV/FQHY8WOkdhFM9Jv3jqj0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=go158nx8BH5wgKLMjcmj2GNCaGpXFTv8GALgZhbg1MwLzUu1PiIKmQ2hf6SZ5Totq /G72za/RW+8/JEEnUYwSWGLIRMEpWrQgjbiZVx42Ewbnk6ygizBccxGBjzAC2ZVaRZ EgIKM5yBQfdEDEyfNkL/cNCsqR+bzpnQPomrt2vJ9SMYzihGiEvxNDH2xrUi2crUT0 UVvlumPhUfeA7lgNWOee6C0wh1ggZnRFo+pQ7CM8cS5Dp0Ass3mKlSGclERIvJlBh2 sQxEpv9agPUOTNo+AXW3DAKDn4dxWrOylZIR4GaZ8oP0nfxaKKv/hSYdaVCzt6mXEv WRN3GPr5BSogQ== From: SeongJae Park To: Cc: SeongJae Park , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH v5.2 07/11] Docs/ABI/damon: document fail_charge_{num,denom} Date: Sun, 12 Apr 2026 09:19:50 -0700 Message-ID: <20260412161957.82835-8-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260412161957.82835-1-sj@kernel.org> References: <20260412161957.82835-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 Sat Jun 20 17:31:34 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 7517830C35F; Sun, 12 Apr 2026 16:20:05 +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=1776010805; cv=none; b=H8MbJ+nVYB0dGDG22qqUVn9O/uCZAqwuHRRElORKMWx7SrqV4qqQKDCPFNlT98f4J6b9xfBqjJJoxriSEJ9hRYfnCoeyBgyXjIwCP09mxT+CPMfDuxJEb9voK7KfzaKYe0760COdqcKBDiDiXLd4EeP8ocredpw3iqBzfHA2JCU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776010805; c=relaxed/simple; bh=oBXW5uIN8lzshHczxlHFHeX8VLmiX/5T2Hz8N+WZ/sY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nxKL1VpT4StTb4E9A3VdT2Ur9mgckeUfMxNmKf9hhsIu3rkPk8Bx59s7lRzLFbQoZd70Di+aLQ7eQtRzMYoezODGB79/zQXXq1G6DnWRyBPv1M1DzXzi9EpJI1kGYIZhW6nyEvgXcIKEhkqTw9/+5pxZmjaMIeZlk0vFRueBrMA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=u+QPsNov; 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="u+QPsNov" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E965BC19425; Sun, 12 Apr 2026 16:20:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1776010805; bh=oBXW5uIN8lzshHczxlHFHeX8VLmiX/5T2Hz8N+WZ/sY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u+QPsNovzlK80YmtrwBP4U05y1zDbVdemsKIeAZvBdz36NnKp96zp7tz+KKjgCQdP 0Dbr7t2hfCgueYz5486y6/b4cbMniEXNHve/xCkeU/TjsAU8ObFZHz8yY/aDiHWfmx 4aXSC9Dt4aMja6nKF+NfoG7zs1UkgoNLYvYXy6izvGo++BniCHZ/sg/+JR9y6xukxB yous8y810ey7XqMqTY9i1sTbQ+aH/vka/AEL5yY9J66KB5EXDZNXx1LWe2/FmBcDaE /Bf4EAtmgPIWMrKsCXv/AUYSHHNX1oOxz3V3LU+wbc0SpfCdP3VWH8FJatMwZyeeIV VhtisjV33f96Q== 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.2 08/11] mm/damon/tests/core-kunit: test fail_charge_{num,denom} committing Date: Sun, 12 Apr 2026 09:19:51 -0700 Message-ID: <20260412161957.82835-9-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260412161957.82835-1-sj@kernel.org> References: <20260412161957.82835-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 Sat Jun 20 17:31:34 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 EFBF63128B2; Sun, 12 Apr 2026 16:20:05 +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=1776010806; cv=none; b=eqHdR/h+bH+pFfaUKxFFA31nwIMxxCEjBCu208qTf4EZxpS7wWjGPMaTVNk3GQU/3zMlUeASdh3Ns6KTR/vfG2vhxtJiLptdDmybiAnGGSCfZY4A416NJ0NBXuYH4RpKATYw8OySPr+CqK1DsgXSPKn/+5y7vGmUKACPu1j8N+E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776010806; c=relaxed/simple; bh=EIRB4p0R7OQMpXCAySjtmt5LRqO984ojhpZfxIiXyb0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VUnP1NqpxOqr+rF0L9DryiR3h/cegJhSLU32HVVPGvFc7y62HdWuwb94mMINlinSxOD3dO60IBCxcnU7TIWweBaJ6QH9mMIeuQysc2/l7+EN545ZlIcZjeKMS/ARWez0ISUQQ9/jRIgvUF0phQ/mQ1DNOFVS+JJf+hGM2bWsL5U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=AoaL4d7p; 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="AoaL4d7p" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6C83EC2BCB4; Sun, 12 Apr 2026 16:20:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1776010805; bh=EIRB4p0R7OQMpXCAySjtmt5LRqO984ojhpZfxIiXyb0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AoaL4d7pmxfMgt9EFFeZzqIPSiLvPK2MG0/aV3/+v8PoP/2jL4y2mn85aok/vAeWS lUu0fcxy0JU3ldWr3YOHtd2OFM5v5K6Yb7OTnX/kU9eU0/0vaO42Fk9/UmCzb2O93Q sXxZbMM+xN7z5pu8vzfffpXx6Xjt3suKivPtQzXhpFMlwUaz1zOTkcuPU+3viyCnL0 +Vdfxr8Mz5AaQ9YgLBYxkhybS8lTH0Suds41A7n32kjeVKLmA5uRyq7FifaZMNrnkv W2q1BeImO185lV+9iFHQnaD9FtHcIe+FCUYtcXbqquPEsLI/JvtNHEK6pmFhyAyl95 jmW5MVuTEI/Zg== 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.2 09/11] selftests/damon/_damon_sysfs: support failed region quota charge ratio Date: Sun, 12 Apr 2026 09:19:52 -0700 Message-ID: <20260412161957.82835-10-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260412161957.82835-1-sj@kernel.org> References: <20260412161957.82835-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 Sat Jun 20 17:31:34 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 A3A643164C3; Sun, 12 Apr 2026 16:20:06 +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=1776010806; cv=none; b=JDiHohOdYlikO2NcpG7/fA4pNYtfALDABtXDnGUgB4B/7d9RRFKTNpQ2XqoJqGIsWcleabV79bFc6DhNsfn0VjzS6cJw3HIiqQ/2u4/CLv58oB3erBzj56/J1OlFcUkVLE5uCHuf2hRsthMgSvosrH+WBqFmBLhSFyANC02eXgY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776010806; c=relaxed/simple; bh=EuOHul4fripHvwsgWhBfbomSmWCRXpHL6QQJMWdANgQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=T3JMO8g9MAYsnHNqJlb79EPEqd/I+F8VDsvZA7zV2GrjC/mFG7iY2MsOBDMbb3iAcZhyKra9Db7sQ682s5+9UB8ZnBBJElTj3MKnF0Nt/I691f1vWmUdtysWbvVoHv2WZ3XICYf0PHy6GwvTj+e/YMerBxDu0oEs5f86NYKjF4I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Jf+a2hVD; 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="Jf+a2hVD" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CBF2AC32781; Sun, 12 Apr 2026 16:20:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1776010806; bh=EuOHul4fripHvwsgWhBfbomSmWCRXpHL6QQJMWdANgQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Jf+a2hVDjrVEvCGNr6lCjPwS4jHq/0cEijEDJBeVzwrnsicQAQFsWzgYDNBLgmpLw JZFy5ZIuVp3VPwczOeJxiB/R3KbaUqyz+8ST9N3sz2bgpaa75i9EM2A7aQrKlHIQr6 AYLlLkOXB0FJ5pXp2BodwDO6mh2YJjoiadkxZKO05Nty/s/gj8qB1GNI1ebsvrvp6V 4OX1R08hIznpWvvRb4PGnOGI0wpVZ2+gLBdXRjtgj9jAvSuT9zavW+7wc4ZXZhoYHz 4kTWcY5S5MDSm5ELXfLy6CqdfI66M5G8fvLDFY/Sqox9YHPvsGhjYi86YlAD1KJdPg eEfdVGUwn4Khw== 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.2 10/11] selftests/damon/drgn_dump_damon_status: support failed region quota charge ratio Date: Sun, 12 Apr 2026 09:19:53 -0700 Message-ID: <20260412161957.82835-11-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260412161957.82835-1-sj@kernel.org> References: <20260412161957.82835-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 Sat Jun 20 17:31:34 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 A3B7C317160; Sun, 12 Apr 2026 16:20:06 +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=1776010806; cv=none; b=FAyiay3ksB75/Ny2akYJG8B5grvrmDkRuE/Fnj33gaPHvsHirZtss6biclmD6TyAw81+0Cbz7oAwok/+xglpcVkLDqyQOGoEbeloT/jaQHF+jNpj44RihKw6yGkyNvnnwyzU9d3UwbRkg0zTRqlTMWzP73NULA8MSoQ2SljlR8A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776010806; c=relaxed/simple; bh=t5zJdXrSXfUqeg8E0cFC/+8XELPbXvEetq+3G/tXFao=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XypoSWFsRmZ7pslV+XZRxLe3B5t5qTLBBSnzgSmi7UEuCkWSSh7uD3bToJ1ljZijrLndxpv+bcgHUB5NJHsILwVR9ICLyFh1gj+tRJ1piaj8ypGsHmUc1GnQHB7r/+parilHnctbi16YIoIDZOP56aNb+MzrH1V2yQ9D7z3ugpw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=TgIR1Wnq; 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="TgIR1Wnq" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4177AC19425; Sun, 12 Apr 2026 16:20:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1776010806; bh=t5zJdXrSXfUqeg8E0cFC/+8XELPbXvEetq+3G/tXFao=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TgIR1WnqGlS/2JgAAt4SyAiI6Mz6Y24ftLG/3lSrscUXV/UXc4lXwh0b3GVFWZx0d PV6spn2SBCkf8mWpGADK9YnpY5LQLfvjx1gt0qD2qyirArEICcyWADdmKGqyX3phFX bWQldELArzcWTUlyUpJayPkdy7p/0aNzNYP+KonViexTh0ZtwfQ+W52mshdEzf2o6j JD6GlmQ72pJhXaST5RvDdqee0Virrk4YUmsxnqXBcGfN/sggfuKfwx0oxRqDm3sFmh G8koSn6IO8GNVq956ZzMpPMglmZr55ZoJHdGBcXEh7KwiV7drYA+N3pGi13AF0XjMk vrCnbIgJ0E0ig== 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.2 11/11] selftests/damon/sysfs.py: test failed region quota charge ratio Date: Sun, 12 Apr 2026 09:19:54 -0700 Message-ID: <20260412161957.82835-12-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260412161957.82835-1-sj@kernel.org> References: <20260412161957.82835-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