From nobody Sat Jun 20 23:04:15 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 340993D9DCA; Thu, 9 Apr 2026 14:21:58 +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=1775744518; cv=none; b=jlGCFyrM8pcdsLDeMDNw9LyXyPgdt4XnNazJsdWnY2Ry+ONE3UeZVJJbbNBTL2xEIiaLDLO7UJpZ5q3sl7VjmsEmZXI9DGYhtqIwb8/zeI/sDG+I+AGOKS96PbQ4Th6W1nS1IrVsZ/Nosr5Ye7y/IZ/YQhLkLIL6UkGH7c/6yrc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775744518; c=relaxed/simple; bh=npLjo+Ub0jfADcpNQiStOidPGi9YtKWTfRmpcD4bUVw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=A8s9JB1VmOdvm2xflLD7qufMMm6KMCxsePhy1Wv3IPGUq+DFlFuBzedycFH80I4mnyAAPK4fT3ukj1hVuZLDo/qkLITZkQ1bU9eOMhcmNdu627t/OimaDYzApNnZF8O5Vaezek/YXWVWdm1FfgFHw5RHvapk6BtN/UKf4SynoJE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=NIxUwKtO; 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="NIxUwKtO" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91169C4AF0F; Thu, 9 Apr 2026 14:21:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775744517; bh=npLjo+Ub0jfADcpNQiStOidPGi9YtKWTfRmpcD4bUVw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NIxUwKtOwG4ywbtgEW36oE5+pKMqXVhMcTVuPecSkbxd8ZbD7B6cdkpasYgCYWr9T Ajx3KI+UCIrQIt2IOcu7Bg26hsRAwa44rVpX4OXAjAfQxv0VVqGnz/uOV83o5WONKw oXMIOUB4i7PLiKIlWvIUoSk5vCqBzgr/PCF8qvhT8lhnF5zEuIHn+4fSARhUqhAEfq pJ0rbqdLqGBlE2v32cN0nq3eR62f//CyVOVt98XHsnqv+/X4SEWh3dpxNKTvHcrpBs Lsf7/ctPOZw1v7B9ucRqDo52tH0uVqdNhU4wv7SAqQ3XNv82edAFdglsRGevaNFR3x wUDmpWKt/OWPg== 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 v4 01/11] mm/damon/core: handle X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260409142148.60652-1-sj@kernel.org> References: <20260409142148.60652-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 Sat Jun 20 23:04:15 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 5B5183D9DD5; Thu, 9 Apr 2026 14:21:58 +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=1775744518; cv=none; b=AuhCBKPMGjduasZjTyFLcaILw16J8RlHQaWuJoojqs6qXIh1ipOsAtls5v0hWGq22+4/355Ttx2OD9dXjq6kNpSeP4jhXiAm7RIGqdUKwMW8Dqr2aH49TukSoc4y1MfzHCNIGjEGr8wljKzFdSIqVDY3GxVnUUybOJQCbIDFD2M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775744518; c=relaxed/simple; bh=RDGyHZ5IvHxpF2pat4DZ9fNQzQ+auTQEfUiu8Hjau5A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bLhhaYELKZc4wCNao8HMZFnZtGU8lJZTiRnf1Hv8pzW1WUZW9zOuSbFBlfqPpVFDi5zrqvAFeGK673odUuqOPF0M5QQe3brw0nOpaAekhcRXv4i8NXequrK+1fwu1KWqCXK5RRjz+RjK/Nk1p2hhqa8Cp2Apyvn2jl+2c5zmxM8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=SVfJPkjw; 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="SVfJPkjw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 00108C2BCB6; Thu, 9 Apr 2026 14:21:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775744518; bh=RDGyHZ5IvHxpF2pat4DZ9fNQzQ+auTQEfUiu8Hjau5A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SVfJPkjwteZ/uQ8aiGsD36acpad5x9EuM7S0aDblTDji435AVshSCmYg4GdsLIrmU uEe81l092mwj7f1HOIKSWLyyXpYzDnE6h5+B3IL6XZryAUX3i3LX0zloz/55JqJZnP SrSRbTSGJgoLUuT74E9ujRTK4Ispndc1cuENWsB6CwJdNwNf/9sPnlzxzE6T/b3pqJ IMT4yHCzXtq/nE3gNO4Oybc1VCbcTXVQuppsiTcEEUM9fy+stO5JGgPMAgaAPP68Gn TwhYwcHTxpRs47bFOGIaZ7jIgjmt5nE47gYjrnEvDBbJCLmswU1yNPxgMIj3PnlUtN hJFoEaShCMCfQ== 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 v4 02/11] mm/damon/core: merge quota-sliced regions back Date: Thu, 9 Apr 2026 07:21:37 -0700 Message-ID: <20260409142148.60652-3-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260409142148.60652-1-sj@kernel.org> References: <20260409142148.60652-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() splits the given region to avoid applying action to the region results in applying action to more than the quota limit memory. When such a split happens multiple times, theoretically that could result in violating the user-set max_nr_regions limit. If that happens, DAMON could impose overhead larger than the max_nr_regions based expectation. Such cases should be rare since usually the real number of DAMON regions are much lower than the max_nr_regions. Even if it happens, because the split operations could be made only up to the number of schemes per scheme apply interval, the impact will be negligible. The impact could be higher after the following commit, though. The following commit will allow the action-failed region to be charged in a different (less than region size) ratio. As a result, the split operation could be made more frequently in a corner case. Still it is a theoretical corner case. But it would still be better to be avoided unless it causes other issues, as max_nr_regions is one of the important user parameters. Avoid the violation and resulting overhead by merging the sliced regions back, as soon as the schemes handling for the slices are done. Signed-off-by: SeongJae Park --- mm/damon/core.c | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/mm/damon/core.c b/mm/damon/core.c index c7d05d2385fe8..98ee776d98cd0 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -2159,6 +2159,33 @@ 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, *next, *orig_region =3D NULL; + unsigned long orig_end_addr; + + damon_for_each_region_safe(r, next, t) { + /* + * damon_do_apply_schemes() split the region if applying the + * action to the whole region can make quota exceeded. That + * split can result in DAMON snapshot having more than + * max_nr_regions regions. + * + * Merge back the sliced regions to the original region, as + * soon as the schemes-handling of the slice is completed. + */ + 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; + orig_region->ar.end =3D r->ar.end; + damon_destroy_region(r, t); + } +} + /* * damon_feed_loop_next_input() - get next input to achieve a target score. * @last_input The last input. @@ -2528,7 +2555,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 +2577,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 Sat Jun 20 23:04:15 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 B70E53DA5BA; Thu, 9 Apr 2026 14:21:58 +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=1775744518; cv=none; b=CODuFd0XrtWxdw2Qi1I820eZ1X9G8juwC0UsekNed9PnWQObv+P6rDHxj015JwUUB8SyBNzOefHoZoHHDT7MsJ0sXdhFMs3Bdn6UXVvHRFILnQJyebSC97GfdhZg4eZmfYdKnOmnX98JC3WDDvRxF/NNIk5hFlYo8rBRQ7bMM8g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775744518; c=relaxed/simple; bh=Ua5QdDPSrmF7qk60x9qhk5zPOg78lHW5pfwnkyXM7Mg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VKQejMgPAdqrZ3UXoBmIiHA2n1iCIxRZZwd5WBoMrSJPJA+/t7JBkEAyC91bFRBOX9OeN/H04hF3u01UXxSFwT3MRtivInjGoEh3DtjtGoXcw92MVeaoM0Uj6D2Hpohvjewag28BeDNwnHbzR5kX5kxPBgV+Bb7ETfGPOIQR+go= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=IeXv2CNY; 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="IeXv2CNY" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6303BC116C6; Thu, 9 Apr 2026 14:21:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775744518; bh=Ua5QdDPSrmF7qk60x9qhk5zPOg78lHW5pfwnkyXM7Mg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IeXv2CNYnBymqV+fpSFzyT4/4/w06i1mXTdL6/tP0eLlH4uv/x7n048JoXB/vjcuI ITigxTa1/MmtPmZsKoOC1vTjdOdldl7ZsVda5Hn3/ctFGcXK0NEouzcpsEyaD7jNHk 1WGULZOOj27jCjMcwIKCliaHrgcWbb+9FjkcWkxQgRofA1GEqjwyfc6hpTpEa0xR0B uAlrr0A6aGFk5+B5qHMtZIieqT5dwrb6SX59wT7au5LCP81hXtinRnOogm5HzTzxFa oLA9OnUs4XwCA+qPW39tkNtsaqaf7D/CY+ki1U6o1X0hN3D6QL/mC1W5cKnBAZVxWO BYQRY+p6wmnQQ== 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 v4 03/11] mm/damon/core: introduce failed region quota charge ratio Date: Thu, 9 Apr 2026 07:21:38 -0700 Message-ID: <20260409142148.60652-4-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260409142148.60652-1-sj@kernel.org> References: <20260409142148.60652-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 4b69f4553267d..9ab7331775b9e 100644 --- a/include/linux/damon.h +++ b/include/linux/damon.h @@ -233,6 +233,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. @@ -262,6 +264,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, @@ -276,6 +282,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 98ee776d98cd0..9b9b124e867d5 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 Sat Jun 20 23:04:15 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 121803DA5DC; Thu, 9 Apr 2026 14:21:59 +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=1775744519; cv=none; b=J/l6QCWN5JCo+mWulwK3TgoU7rmSglig1h4swmmAywK0kzou5VWCi6ryE6NQ/mApmVlF7Q9ExJLNS432DbN9KLHNTx/qC6ksG1f8b0d48MW2kSCSW8Yy37g/c/NY6vlXDq7P8eQyylYnOzsHZAofY+XP94SgV8BHqSF0LtKgOTI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775744519; c=relaxed/simple; bh=F/M9rB5L2tN6LoRT9CXC/JolkzvZc5e3+oNuxF0asr8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YgnA1SDdCJtXj/7RA9zbqSNtg4AEXjykotjt/ZNdXsaNPt8vtlaaOUC9DxOku4y6feoExg0ZFrW8Ukf9y0k+j3oyLzcOYfSIr2JrNxFRGwpsIiWcBRYoDtLFnp9un5RHKg0E1HmDrUdqbyXJEzRWhdJQzLCLopk3urb0ldN4qUE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=lUuANX1y; 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="lUuANX1y" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B5CC6C4CEF7; Thu, 9 Apr 2026 14:21:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775744518; bh=F/M9rB5L2tN6LoRT9CXC/JolkzvZc5e3+oNuxF0asr8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lUuANX1yzKuXdAUEGvZuwhRVRAnJcP7DD+EwoCbI5QOBLaH6vgyQjY0tPfLeo6A1z mLWmc0yVMIMVdV6KGItV0gxOFqSJ9DoG1aqlsDBIoDqU5fJpMrXH4mdVE24nAaNv1p wxQlQX9BAKg6YNCV7QVfNmnfSc5TgpSmd5JHfsQ4WRtKCbmxY5Nv08sfQ5Axw5sSzz vByLAu6gMWFocxSt6kNabl/b75O0Ay+3tK7+vqc0j842EIMl1gxGS3SbM3DT07HGo1 TlX/fCaSiiz9YwBPiZ1WQVjhmzT5SzLwQ+83ERfuyvcyR7eGVpniCEhhz3RHk5lHPZ Mtrnby5cNxhtg== 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 v4 04/11] mm/damon/sysfs-schemes: implement fail_charge_{num,denom} files Date: Thu, 9 Apr 2026 07:21:39 -0700 Message-ID: <20260409142148.60652-5-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260409142148.60652-1-sj@kernel.org> References: <20260409142148.60652-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 5186966dafb35..d5bfba79f105f 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); @@ -2776,6 +2828,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 23:04:15 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 DB5E83DB621; Thu, 9 Apr 2026 14:21:59 +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=1775744519; cv=none; b=bBBhlrYQC5HUvcUpsAcZrnsnpDskNeMw9uORfeWbKftPJSJWuJX31J5W89Ur8HeJiN/Dr+eZSqxrJp1IsJ+GEMxru5zRDBUMeQ1ZBpNx6oDmilumEtofBCEE0BUoX+a6OkdwBIRiRNeKNCDaW25B0Wa2KTsbJqbdWHNZA3dLdg4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775744519; c=relaxed/simple; bh=88ilcTiVHxOBPfSO6beti3cUyMc/KjPaTfyvCKtApUM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VaNt0usDHREjfnlbQE0+IDDzLeqzUh4ii86Y8Tqkrz4HUQRYWnNiEifWNXRWPtL4QtmJg0ei5ZRKlgsZLrlUSruaoLix1woL+L0dc9ueKNuuZbwXNHk56xhEt8vSI3d35aU7tZlJGRtgJuoF/dWmUp+SSrMCfInQmFNJUOjvGeI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CkDeT/lm; 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="CkDeT/lm" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18CFEC116C6; Thu, 9 Apr 2026 14:21:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775744519; bh=88ilcTiVHxOBPfSO6beti3cUyMc/KjPaTfyvCKtApUM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CkDeT/lmDk6C/Sl+XwY4s0Pbx75AJHzSyiv62uorGOZwQhxrHXj3fyGZJ3zpnuUrP sNArzdquT+YjNnnriUtVSrjbIkPxrVA3ea0VYeJGVmCd9rzrzA9Cvrr4Xvt8PhJBNM MKR+rUxXJltnKqciSCdSKCRaXGcR2hJAWYw778XEP/jSIP+Eaf72IB7wpf2TzAPnoa VIYefws8DpGNUQs4u8IWm68FnFnJ4j0xoXp3ruP1MoK3wyX+FJhIzxJ1t4lP2VMGqr Hx+8aScbKI8cI2qhDJUFmhSpQSpFwHP88SjHP24EZvveE4orT2EbzIUhvYzXKNwjSg YpNaUYx6nC/jw== 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 v4 05/11] Docs/mm/damon/design: document fail_charge_{num,denom} Date: Thu, 9 Apr 2026 07:21:40 -0700 Message-ID: <20260409142148.60652-6-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260409142148.60652-1-sj@kernel.org> References: <20260409142148.60652-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 510ec6375178d..94e898b671d15 100644 --- a/Documentation/mm/damon/design.rst +++ b/Documentation/mm/damon/design.rst @@ -572,6 +572,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 23:04:15 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 B95BC37D137; Thu, 9 Apr 2026 14:22:00 +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=1775744520; cv=none; b=cp5Q5UQCOp4uQ/enGDu7MsRDQnHKDgnRlb33+ZL1Bdx5JKgsSNN/DkYM5e4TK4Yl5XNVZpfsKGGoQ17BkkyHH+rDJYdoltK/hWuWQC0P+uwuCZSWsiCVMwU0sgenQw7tTY4AB7mLPtU//iCv5Q992JHNrMPITCXBKwZIaq91/UY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775744520; c=relaxed/simple; bh=fJkIAWWlo48QPdeJ9YXUoXHCIlYHiM9shoj6TYfrLSQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=WKhRMHXsIW4aee5grb7S2Y0kmollsLabfV1ZUhZc7exr10cgUPcyQvyljEOaxHd+2Cje9ulMhJpdsHbxC6Kq/agRPdzyDe+1sIZOXQson+d9kggDq/d5dwFXTe/IWepl4/s5ohiLN4MkOi04z/wsWIZGSLutjNp2RMtrMjYlWvM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=sfMH/rgI; 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="sfMH/rgI" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C67D7C2BCB7; Thu, 9 Apr 2026 14:21:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775744520; bh=fJkIAWWlo48QPdeJ9YXUoXHCIlYHiM9shoj6TYfrLSQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sfMH/rgIG23R2sVZou/u5urM9GEPi+de/rGnn2mbfua0OTdBpCdO/Q5LfZLGQUwPo LrK7xdRuwGKThJTP5bNOOMJXPSYojXqsFGeszk7yh0O1vHR17EI5OKDdB9D2PIXEs5 NTaQP5oQq50VF8jzjNccnyE8/uzcxuZC5F+lbKAD0WaNuosq1lqi1wLPNspl1r/mVH 2FttddCEr4OchxohDhW842Sj72elGxF0mIhT6y9beNIXOFBcHJDFyw13jRd8i8NId5 4E10sR2UjJjAS9MjsabTTC09Bqd5D5kVIIP6ofGGLXabNN+MnRszkJlucctj1qwJbP 5vk7mCfBGkLOw== 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 v4 06/11] Docs/admin-guide/mm/damon/usage: document fail_charge_{num,denom} files Date: Thu, 9 Apr 2026 07:21:41 -0700 Message-ID: <20260409142148.60652-7-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260409142148.60652-1-sj@kernel.org> References: <20260409142148.60652-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 23:04:15 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 297CD3DBD46; Thu, 9 Apr 2026 14:22:01 +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=1775744521; cv=none; b=ApYldlpaZ1py9S0gycAWV0+7LHaq6vUqLXnL50i+vv2xLk0Bufv5tsHZnQ5tOYF4yt/bxIvFdq56r05cUkMpQJNrGL93S+3VBr/8+nvCsgXaCdY1+W/cW5Ri+/rzlSgPR4+efm4+vvyk2Ve7r2OyWlvUhQmZEO72W7k03RTz/d4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775744521; c=relaxed/simple; bh=WgiRHi50zFvHwjFSQiNfyV/FQHY8WOkdhFM9Jv3jqj0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kIBsINMt/BD2tnHiCTR6S06YWuKlcx0WTZhxq5Fgd7I7/pA6TsU8yAjpJokSm5yqe3AxRn9omudm550xN+QwLQNVjRfAAy8TKT01fgJagJDJ1gUXKDYKj3B6VvvW+p/j8gwXLDt7k4rnI3Orv9iEPmGQYn5yHF07WvLoT3lOCjQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LYT5oBO6; 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="LYT5oBO6" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C1611C116C6; Thu, 9 Apr 2026 14:22:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775744520; bh=WgiRHi50zFvHwjFSQiNfyV/FQHY8WOkdhFM9Jv3jqj0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LYT5oBO6tiXFMuvEgp+KNnQo1cmvDK0jPdcht+aCfb+Pa4+rQHAWdVN1XOsqusoPU Sc0PzqGmmzvIdU5tM/b7Jw7EBbCx8jj0SUp8ZJvuOSGEG9HFwRCB21ISKaV5I42nsx j9MrDL3JV50XuRcYNRWTTo46hRr394ljnaMadDWtdbN4BAdCBqWgmJRctVV4erRP1a tq3cyC1BsN7DFp3q42OS3kAA35WkUAfNzu7y6n9OBZe/K/oOmtYwPmvCG9F2guUhHK Wk2i6s2F5A/RY3Qr2BMQjPqH24MUrho/vINs+aIA1W+2qCh6ngfOnrXYSanPm1ygIk TWkQM6t+2ffEw== From: SeongJae Park To: Cc: SeongJae Park , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH v4 07/11] Docs/ABI/damon: document fail_charge_{num,denom} Date: Thu, 9 Apr 2026 07:21:42 -0700 Message-ID: <20260409142148.60652-8-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260409142148.60652-1-sj@kernel.org> References: <20260409142148.60652-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 23:04:15 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 974CE3DA5B9; Thu, 9 Apr 2026 14:22:01 +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=1775744521; cv=none; b=FFdxwE2YND6O5lbZ6+4QxI7F4mj/Onr/f2lViieJqNem4VEa2SIZ5Xq8b9BUlM2KoEH0nOK1y6lNMIy+oaXFPxN3bx+HPeRRX3CzitwUzACLMfm/YH04c6MX8EHyAkwEsuA/vxy5p5RfiMZaedr2lsior6kuo36AcADiGDOY5UE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775744521; c=relaxed/simple; bh=oBXW5uIN8lzshHczxlHFHeX8VLmiX/5T2Hz8N+WZ/sY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ji/KfwEZquDawYZ5Ct91VLOxjTkbWOr6g78SsVQEQK/TTPXPsx/zObySXd0sZ6AUfMzuvZr1pQjt5E4Z2Hxl1GS1toJEWvt0nFlbSiYcOGj5VqY2bdUUoTnQsnxfFE/Zd7hzD/aZ9myvRilhl/qsMg7ybEC0T0yPpr7J/KJxqts= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mG0EerkI; 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="mG0EerkI" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17C89C19424; Thu, 9 Apr 2026 14:22:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775744521; bh=oBXW5uIN8lzshHczxlHFHeX8VLmiX/5T2Hz8N+WZ/sY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mG0EerkIiWXO/JhNf6dSmW4UlSyrnzmIhzLE/KjFgogaQCYgaejI1UOz9d3lXPg9z tPmdXPVkcI9YxidqvcLpYDgqXOWnVQWRw6GxCK0srLLKQgJU0hp8DB43Oydn9WaJrx jlNGLVY90llnVQ/aJBDspIqKBYx85OJVjzlVwq/3EEhjAdu2eECuo04ClE1+SPmhSK lKncYJGBbgg9UWHoJMPLurMfgKO/JeYKj+bthU+vvB9Un5b3dxZgOaATP0i3/NLsLQ cM2B1JSpn3xlS7YjBdcwf0gVS8psuTBCC42Igh6wveEXEIlI6g/JP1/Kv86+ySHafv wOlWQxvl7pqvA== 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 v4 08/11] mm/damon/tests/core-kunit: test fail_charge_{num,denom} committing Date: Thu, 9 Apr 2026 07:21:43 -0700 Message-ID: <20260409142148.60652-9-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260409142148.60652-1-sj@kernel.org> References: <20260409142148.60652-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 23:04:15 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 ED44A3DA5BA; Thu, 9 Apr 2026 14:22:01 +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=1775744522; cv=none; b=mviiKhZwEHTqN94D705DXNI9Nqgp3KREijv4z3Nimndc7lpIAX2PpqCtKIqKCqEKSZmXjiXQ17uh4CdBf6f63bo0+9H+K2fgmTXMd4SvYj0WGl08jjFzSpvPc1KWvNW/ZSmfVw1gOgvbRKqJhqfgCXkV0jExn+iWtHS4kOFc8Uo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775744522; c=relaxed/simple; bh=EIRB4p0R7OQMpXCAySjtmt5LRqO984ojhpZfxIiXyb0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AXo2SUVn7gYgszO58+TLtOLmon9NnHD4KggZdKfN29vLyldA+OH+LWeo/5WNK60cGVBMkhpGQLa+RGC4KDYKiTzTP5vlKwCQBqTxy+Nuq+mmLTXF7Pf65JmzjkH9hzYZMOuVUbB7RYH+t/ZD3cwfuSjw2Z4GOyHvXYwwGu8iJ7o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=lm5DwTkB; 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="lm5DwTkB" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9743BC4AF0C; Thu, 9 Apr 2026 14:22:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775744521; bh=EIRB4p0R7OQMpXCAySjtmt5LRqO984ojhpZfxIiXyb0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lm5DwTkBgFBzKQYfPE6Add3IYFy3KBou/Z3K1gwtBLA5e3NIJlZ8YKlM5dSZXAWLw p0ar57O/b3CHFdhDSiz9Tohz0IB/g0MaSJ/ZZy40+yyvca/7E0aMAVS+dVzTrRBs6S U6Uqr7nX1bE/4nvVloKHOiZgJfVuvUL4AvpPUa0eL1qLhTS+nVt4CCWaG934vvFFu8 QK3OSAV1LqKeVNvPmgxgsyYacrJvD4bTlX0TtHec9OFHo3r7UJ1Orpu6wfwGuVQHBU OVlshGb0ntCSs3wyBuOpbrp76y6japs5uRpJbOfc7XbdLYbMkLR+sxe5CkzBNBakGA LHddvzFUJiu+w== 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 v4 09/11] selftests/damon/_damon_sysfs: support failed region quota charge ratio Date: Thu, 9 Apr 2026 07:21:44 -0700 Message-ID: <20260409142148.60652-10-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260409142148.60652-1-sj@kernel.org> References: <20260409142148.60652-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 23:04:15 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 675103DC4D6; Thu, 9 Apr 2026 14:22: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=1775744522; cv=none; b=SSvDkEU4+I0MXYO97rROTpCP1VJrUZ6QnQTfGvFou9MUShYrwAbpoWou3v0kdNce05rQGoVVjorroIwfGyH1+eZpLi6zuQNIh2dPyd7XCM7OGW7T8Spy5v0sQmYUbKWNXPey6wRJrJW0Oo+lEBW/S2pqH7e40BCq7pZ/cO2kdpA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775744522; c=relaxed/simple; bh=EuOHul4fripHvwsgWhBfbomSmWCRXpHL6QQJMWdANgQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Nkk54mKEZK5CRh5lzsfw5XXpnllK0gEM6g7TGsB7hXJtHPlb6vB6rDmvVRPj/Z49waw0nzJhtTIoNLct6ST++dllNIzF5OZve2qBIaO1jckOPpJfwqTKNqfnX7ywcNe3W633vdWHcK5fiRahR9wSIYCQ1bWd2Lt+whqKOS995RY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=oalTStXa; 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="oalTStXa" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0233EC4CEF7; Thu, 9 Apr 2026 14:22:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775744522; bh=EuOHul4fripHvwsgWhBfbomSmWCRXpHL6QQJMWdANgQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oalTStXa4K5sBORw1mgSQoL+F9f6rKw3CicXIy7SO+yYgNunmNGoW5ehkeP7pc3Uz XmkeAD9uXFl3BVeVNireldkfkTGWCdmdCC4rrDMnmDtdEACASjPNQ7WqwZsKQlWeg5 qkNMhwrsCV3TNRI/PDe+o7bFihoabLQlFdsb22SbyHI0VB9/msGKWrVqpysKfM0SFw lubyQ0MPzvoi+oby8P2uIEtlDoZaItQeQY3Wr9Ec/3V+O2CkyWYm/GC80X50YWGuZC pc55uYmPg3yoEMO6Fuix059rBMVLLN8kDFnWm/TO/QZPYsnQHx3y/Dn8jdDRaIGX9Z FPgvBHB2iKNvQ== 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 v4 10/11] selftests/damon/drgn_dump_damon_status: support failed region quota charge ratio Date: Thu, 9 Apr 2026 07:21:45 -0700 Message-ID: <20260409142148.60652-11-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260409142148.60652-1-sj@kernel.org> References: <20260409142148.60652-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 23:04:15 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 B2F2D3DCD91; Thu, 9 Apr 2026 14:22: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=1775744522; cv=none; b=nIEIehr+diA3epjI5P2SfU4/NABdpI/wYR1y4dZgfw67TUWIU26xK+sC2weRzNjf3beRlq3TbOO3wCY4FQjePkaCfX6hoC+JQPx6TTNl8iMBBElM7lgU+deC7JzgHLKmSrDwRLhj40XYS7GAg/Vk9Ao4lt+9kgdulOIqGhm0g9M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775744522; c=relaxed/simple; bh=6J24o91UAsIJGEgFo2jYtnFEeYvJuiRUU82+7XJIPqI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VN6/wRmZS+Y6k4GDqvKUzYMLUwDDE6cAph62Q/vtIDd8zLOByx++EVmP9+vwAvVmmXMtIJb/brWFHU2ByIS6NQc/EguL6f/apnSfjVLsp4k4FLE2Jt5eIuY+sEn5VfL81sjpy0sQQvi+MTbODAoyDT7lc3cNKfPcgoiK3yoqyU0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=DdiA08nz; 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="DdiA08nz" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63D0AC2BCB1; Thu, 9 Apr 2026 14:22:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775744522; bh=6J24o91UAsIJGEgFo2jYtnFEeYvJuiRUU82+7XJIPqI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DdiA08nzY42W5gcsPSMmrHmqg2Bmqq7dj8BUACOLHrnk6Kn0JuA+Ia3qL5/Jq8oDl qJWRVf8VpFZr72rvs8jL9ylsiOx+kIvhPfMFllxLYCXRmEp8GSmKB8Lg8T2l335XHm 5UdTqOUm8Q25h/ErEiJC7XOQ+6Fv7Lvg1fzsvf/NcUSINQxhbEyya1A9LxCUtjsEhK 7i/eVA+ESe+DHqiopwO4nnOdnqBmPXAfsKAe1US1P92EmZJNoycW+fBNRhwXOuEwIF GSanZCI4Ux/10Ecf0eKSk3iGO1ZT+pV4DaV91rh0WKaPRvnQAFdCZjKX+77UL5lKkX /PdNjYpxW1rmQ== 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 v4 11/11] selftests/damon/sysfs.py: test failed region quota charge ratio Date: Thu, 9 Apr 2026 07:21:46 -0700 Message-ID: <20260409142148.60652-12-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260409142148.60652-1-sj@kernel.org> References: <20260409142148.60652-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 b8d6e0f8fd906..d8d4717128898 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) @@ -277,6 +281,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