From nobody Sun Jun 14 22:57:49 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 52BE22E65D; Tue, 7 Apr 2026 01:05:40 +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=1775523940; cv=none; b=h93c0i7sPk96gOYeMeE7hGK4cFRRrnBzeCy4EuVOiXx6dqqpRPoBuDfMF7NE2v/BLhlneAVw7NOxkX764kXAfuQU5/m32rRkJKJCnesz5Osou+BuMqQgSxjzHNyzjz8ytlMApffPRkenPAFH+4a6TMek08bYyrKvFfrIoF/ECLE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775523940; c=relaxed/simple; bh=zHTyjXw4y+b0yGyHvR7VlEA/Pe9whFzT7niQ8ge5IZE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bMLJPAXuWAGkvEFYwVyPOx5LpI8FRUbX/whDknB/2IbJG5HTBxvJE9yXfHWey8wxSCNGIRNEaVTSR4c902c46KctnVTC6/C+zfx/o7pnOg7LpaL9VftSVw2Tey2raz8ZtBbYESI7T2Mi6+V3KVeZA84VQbudNpGHuIlJQycUYQc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=L7yb0Cqh; 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="L7yb0Cqh" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A8ABC2BCAF; Tue, 7 Apr 2026 01:05:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775523940; bh=zHTyjXw4y+b0yGyHvR7VlEA/Pe9whFzT7niQ8ge5IZE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L7yb0CqhTUvm6fdsVbjosf2laMLDVXZ+GXF3roEyy1atQDLruOFhgwXoQcIQYG4iU u1w7FyOk/11obccmkI5MuHXUGxgSgkYudXogh/r0U1okDZdkeQ34d+mrllztFyk7K+ mwCNvPQ++cc48LkWawrLW+/TDC7sEgufZMnsYM2ZzMR73aIeLjXUC+2P5Vey6/PN3N YudrR6buqFOU3mtlekY10Il+GOyO0A//fA7QuMsGEbs97/s0nk9jqb4kvYJqom/UGD 1TnodkhJrmZjaoyLoczFwmWqouHV06DtzEfX+N9e/vyPdsfEsxuBmpuQNnre1aNJ+h AHW5A/rzIUIeg== 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 v3 01/10] mm/damon/core: handle X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260407010536.83603-1-sj@kernel.org> References: <20260407010536.83603-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 | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/mm/damon/core.c b/mm/damon/core.c index e680716972506..2a2f767d1a46e 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -2042,6 +2042,14 @@ 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; + return quota->charged_sz + min_region_sz > quota->esz; +} + static void damos_apply_scheme(struct damon_ctx *c, struct damon_target *t, struct damon_region *r, struct damos *s) { @@ -2099,8 +2107,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 +2135,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 +2461,7 @@ static void damos_adjust_quota(struct damon_ctx *c, s= truct damos *s) if (!time_in_range_open(jiffies, quota->charged_from, quota->charged_from + msecs_to_jiffies(quota->reset_interval))) { - if (damos_quota_is_set(quota) && - quota->charged_sz >=3D quota->esz) + if (damos_quota_is_full(quota, c->min_region_sz)) s->stat.qt_exceeds++; quota->total_charged_sz +=3D quota->charged_sz; quota->charged_from =3D jiffies; --=20 2.47.3 From nobody Sun Jun 14 22:57:49 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A28061A9FBA; Tue, 7 Apr 2026 01:05:40 +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=1775523940; cv=none; b=hsRMOHrOE5ifj0/nehUc6nKCTKmAf4eDWLkeiObhwmJGYsjSsRGuCITbjfEfIS0+eiE0/3OK7baCjIg/OrpTpytunN1sh162p5N1NCG9X1LgmKjkB8qO1QTdesQu3T2QUeJiThhp2M858Ojb37s7s8+CgxJych+ddhuhUoq/kAc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775523940; c=relaxed/simple; bh=ko23dhUOeztzOmVblh0gxDT/VcNWr6MRn18sxx/Qqy4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iBVW5OQvtI7NmO5sPgS3n7H63OlXt99oBa4RDOQl4R/9eSwyQu7Gx7UO6i52O4bQc7a9YZoDc2kctM4FvA44VvdVpNFfb5rv2dR9qlfovmDRTxf0OaiNkATo4/f+F5hS8qiFTH9gRD/1LkTd19OnI+WUAz5c/+5EuG7d0cPqJd0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Ya6Chy+5; 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="Ya6Chy+5" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5C8DCC19421; Tue, 7 Apr 2026 01:05:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775523940; bh=ko23dhUOeztzOmVblh0gxDT/VcNWr6MRn18sxx/Qqy4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ya6Chy+5b3AebJKh3STXePoVOGUxWFgrjd1qoDrE7IZae/39lqP/O5feNr/nVI0+v 0KSt5+PKiIhaRJ40NE6UFdKjMP3AOWkvT0cEdC1t/egxInP1+IASHyFric1AAiNjNz bU5sWR/NNJ7zXB8wTNcSLulIXuRaLTOI2OKXRCeYBZnqwGQDMskHPSmKwuiI+Twou2 FdOowLAakZVG05bgpfzIPSx2SNNOtX4FNPaYC7kGqbPjkPQrU50thV+oHlXQxKSlEt fu7TvY/ACbFsmWY5IF2qPZDuID143627GwzGrFnO0UHJY+yDJQCmyYFgvFf7Basl93 8+MecnNwyizig== 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 v3 02/10] mm/damon/core: introduce failed region quota charge ratio Date: Mon, 6 Apr 2026 18:05:24 -0700 Message-ID: <20260407010536.83603-3-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260407010536.83603-1-sj@kernel.org> References: <20260407010536.83603-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 2a2f767d1a46e..692bd3e5dfe09 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) { @@ -2106,7 +2125,7 @@ static void damos_apply_scheme(struct damon_ctx *c, s= truct damon_target *t, ktime_get_coarse_ts64(&end); quota->total_charged_ns +=3D timespec64_to_ns(&end) - timespec64_to_ns(&begin); - quota->charged_sz +=3D sz; + damos_charge_quota(quota, sz, sz_applied); if (damos_quota_is_full(quota, c->min_region_sz)) { quota->charge_target_from =3D t; quota->charge_addr_from =3D r->ar.end + 1; --=20 2.47.3 From nobody Sun Jun 14 22:57:49 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 49CAF1DE2A5; Tue, 7 Apr 2026 01:05:41 +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=1775523941; cv=none; b=GH1IT95eMjcpbHePfyRwNL6wLqDq/X8V472J3lDDina2WWex4ZZxw9EvjalFB3vWmmGgjkNJrtPieK7xa4bmXOBiDw42SD32fM2xjIGEvcghvQyZh2O/DixbBzCz3GMRmNkG78rRaAVHkkbbjSUS9tgiPAP9zQmb2oQ6T96VMbk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775523941; c=relaxed/simple; bh=F/M9rB5L2tN6LoRT9CXC/JolkzvZc5e3+oNuxF0asr8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=q5zTsIi5vzSdzg8EXd0KRhNY43qeDgl0+XnyZt92djub/5LZRdCdqJ4uGdZjNwV5QaoAlGgl7D5Nru4lZIndCA9aGyVD7X+d71aPBBTuxAt8g7r6VjPeDu1Y1whIg+tkSDeU96xs5d+n6Zl1WRgt2sD0dsTqvXHaQz8MKzWmAgc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=XlbS/48M; 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="XlbS/48M" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B023AC4AF09; Tue, 7 Apr 2026 01:05:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775523940; bh=F/M9rB5L2tN6LoRT9CXC/JolkzvZc5e3+oNuxF0asr8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XlbS/48Mf6uB71zliEu31bKAHgwyOtoyJP5Ejkh+bI2n/vpXjLB6HGgXgfKGEDxec bLzIyJDspvJ7BgjPWmxzRyELNhhqbLo+j5JpAmjJ1cP9ZK0Ig7jpagisnWGl1PWwue lxEwyBhyb44d6vZHpHdH3v7DmOHDRfU383qdUz10zKv7FFV3633vKREBK+O6b5pcYY MiNuxsWbaDZMb1/S8N6YckqNOiVYuVK8PclMEvUvB+/Cl+Emm1NXPpzv2GGoZS+Oqe aJvd1m+RUHmTm2SUi8BOeVWJgSKN7DwqT/yDoAA/NE3UUn1hB7NPzY5k6JZIGWA/+H jtEZXvT3e7THQ== 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 v3 03/10] mm/damon/sysfs-schemes: implement fail_charge_{num,denom} files Date: Mon, 6 Apr 2026 18:05:25 -0700 Message-ID: <20260407010536.83603-4-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260407010536.83603-1-sj@kernel.org> References: <20260407010536.83603-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 Sun Jun 14 22:57:49 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AC1861F09AD; Tue, 7 Apr 2026 01:05:41 +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=1775523941; cv=none; b=UnxyrW5fmeV/V+nHPwd8LY6kKJrBXPz2ugnKnNcfoS4dQp5eLj61Ke/V1n9OX29/jR/kXEdcOeLvUT+z32pbqPtMk8HxQynsoP1tQzx2qtZAzVjNbRLjGnzwvvLEnOIpClPWkCwBGIT2tGpI2Xsh5KM0cfH0HB2HDElXa0vQ+fI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775523941; c=relaxed/simple; bh=88ilcTiVHxOBPfSO6beti3cUyMc/KjPaTfyvCKtApUM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sIy5Uy/3FZcUmGIK1uvD7JUBWgYr+5+czMUlWZU1DxLpZeOofyZebbvLJxGoKPGZZZ/A8I0AdfiwAZIpvXlkVOpmL1myc3JvRkVC4V1byPTXFRJ/w91WeB4gdgvfoZA/9hOL+S94Z+I24kyqFVUfY/wmjlL6ioLoblrlVxQnCFc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=hDELN9Uv; 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="hDELN9Uv" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1176EC19421; Tue, 7 Apr 2026 01:05:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775523941; bh=88ilcTiVHxOBPfSO6beti3cUyMc/KjPaTfyvCKtApUM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hDELN9UvJpK+m+DGX2EfCnEss58wKhuhwSkXuXXfP4u2MlMgI50oaavE+X3D9m4Ii x/0jSuwR0bxO7Q43A39xQR0NgC3NfLswQiOYBwmtNAPtNWpl+JHAs4kma3iZnqA9Ku DOh/2wMSj2XDQ4zhp0Y4MWdGLmWMQJouoHplXMIj/qXsni5a9aI9VEUAGVYpYZvDCk vdm8i1uahCo51+NmKHsK9xE9hRpXnEyZTqIk5iUxRCdpBuhDaQySHVj1Xq2FbLeIEI AMyKymwt82Z5nKf69ZKRGYLCQte9tUAF9qCaY05ln8FlP7g0oE7Wcxrm9IL927az2F j/1xc51FzywWw== 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 v3 04/10] Docs/mm/damon/design: document fail_charge_{num,denom} Date: Mon, 6 Apr 2026 18:05:26 -0700 Message-ID: <20260407010536.83603-5-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260407010536.83603-1-sj@kernel.org> References: <20260407010536.83603-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 Sun Jun 14 22:57:49 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 86C2221018A; Tue, 7 Apr 2026 01:05:42 +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=1775523942; cv=none; b=UPO2NBULw+chBRhRXEqUvFc/CVhZ9cN7NE6+C0PPdLoVj9VaAntm44TUaqaTE0M7M1uvydEjHtesrRQUuEg+6pJLPBRIMkz8LxMzj1H7ru9cQ8KK5VcoZHC/KirMvLUl+WbivaqRUa3thAXylg/Q/gnxcfjXsLu+hjEsJMpHnUk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775523942; c=relaxed/simple; bh=fJkIAWWlo48QPdeJ9YXUoXHCIlYHiM9shoj6TYfrLSQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ZUhStST3kICaw5TmZvmi1CYSIgNpVLwdjeoD5Nel7IXP/ky2zSz2MqoUqoDiAcpqjMeMCuSqQVjAGstK3++RagwaQDR8Mh/f2Ze8xe7M10O6d3AaR7sZ7CVQ5Tjk4uxYG3+L+4/923yy3s2jdrLuza/OA/os8UZfFQlwp7adg30= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=duZ5j7Ri; 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="duZ5j7Ri" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B84F0C2BCAF; Tue, 7 Apr 2026 01:05:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775523942; bh=fJkIAWWlo48QPdeJ9YXUoXHCIlYHiM9shoj6TYfrLSQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=duZ5j7RitylXgIF0r34wn53/5JsJMIqsp2yGMeqTQWF7SyL7sxahK3UGmDWdWP1RY /BCYtw6ciBilyEOASjGV+n4te0kGWmLPxdebfPZfkEPEH/SPweGgNSVzTFwucDtqNA wRJO8pd/i4N9ZwQPJobITh+rTQIUyCcYZU+wunhn+kTHO+3JcruVTFA1ziD2NLU4gk I6Q7/+hMnhbVAKdSrAPWOISGvq8ywMSgvLKca1FveDjbQeL8wUIXTrjWehJdkK7naO +y7innO1OMGnpyDMOjchstBGTspfgDHjc3qlOPKYA/+bl0MBQ9p9Gm8KO2BFxlNrmQ yqtLokuYkYGJw== 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 v3 05/10] Docs/admin-guide/mm/damon/usage: document fail_charge_{num,denom} files Date: Mon, 6 Apr 2026 18:05:27 -0700 Message-ID: <20260407010536.83603-6-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260407010536.83603-1-sj@kernel.org> References: <20260407010536.83603-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Update DAMON usage document for the DAMOS action failed regions quota charge ratio control sysfs files. Signed-off-by: SeongJae Park --- Documentation/admin-guide/mm/damon/usage.rst | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/Documentation/admin-guide/mm/damon/usage.rst b/Documentation/a= dmin-guide/mm/damon/usage.rst index bfdb717441f05..d5548e460857c 100644 --- a/Documentation/admin-guide/mm/damon/usage.rst +++ b/Documentation/admin-guide/mm/damon/usage.rst @@ -84,7 +84,9 @@ comma (","). =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 = =E2=94=82 sz/min,max =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 = =E2=94=82 nr_accesses/min,max =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 = =E2=94=82 age/min,max - =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 = :ref:`quotas `/ms,bytes,reset_interval_ms,effective_bytes,goa= l_tuner + =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 = :ref:`quotas `/ms,bytes,reset_interval_ms, + =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 = effective_bytes,goal_tuner, + =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 = fail_charge_num,fail_charge_denom =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 = =E2=94=82 weights/sz_permil,nr_accesses_permil,age_permil =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 = =E2=94=82 :ref:`goals `/nr_goals =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 = =E2=94=82 =E2=94=82 0/target_metric,target_value,current_value,nid,path @@ -381,9 +383,10 @@ schemes//quotas/ The directory for the :ref:`quotas ` of the giv= en DAMON-based operation scheme. =20 -Under ``quotas`` directory, five files (``ms``, ``bytes``, -``reset_interval_ms``, ``effective_bytes`` and ``goal_tuner``) and two -directories (``weights`` and ``goals``) exist. +Under ``quotas`` directory, seven files (``ms``, ``bytes``, +``reset_interval_ms``, ``effective_bytes``, ``goal_tuner``, ``fail_charge_= num`` +and ``fail_charge_denom``) and two directories (``weights`` and ``goals``) +exist. =20 You can set the ``time quota`` in milliseconds, ``size quota`` in bytes, a= nd ``reset interval`` in milliseconds by writing the values to the three file= s, @@ -402,6 +405,13 @@ the background design of the feature and the name of t= he selectable algorithms. Refer to :ref:`goals directory ` for the goals setup. =20 +You can set the action-failed memory quota charging ratio by writing the +numerator and the denominator for the ratio to ``fail_charge_num`` and +``fail_charge_denom`` files, respectively. Reading those files will retur= n the +current set values. Refer to :ref:`design +` for more details= of +the ratio feature. + The time quota is internally transformed to a size quota. Between the transformed size quota and user-specified size quota, smaller one is appli= ed. Based on the user-specified :ref:`goal `, the --=20 2.47.3 From nobody Sun Jun 14 22:57:49 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B73D0218AB9; Tue, 7 Apr 2026 01:05:42 +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=1775523942; cv=none; b=QyBk+sTYkkar0fGbW5/PX87rqxvVYde5+HpEBqbKa8bbGHx/Ohs+r1xfPB+10k3qxcEdDqR8vMVj0c9Sq4YzyZ6HeoHNFmosJo7+U8hiqk/0TvQdt/ze4wWAzusnL27nqY7311SH9K6ubuLucYDznk0KzKeLmKX/rJAJWBQauyc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775523942; c=relaxed/simple; bh=WgiRHi50zFvHwjFSQiNfyV/FQHY8WOkdhFM9Jv3jqj0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pJSoXOSKFmnFg6vSGOQiEhia+ul9Rilp2P8UXLi6WsFHVHlk5cJ+e484Q9GNgNqEHVPi1r3OWrhE+oVL9llhdK6tjecFpomFzTjOQOrdmX7zVjAKR3g7JK8gstDW79u5FqiUW71ehlMStSveU4rCUuX8ug6yhE0BZCXwJSqPBCw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Id46/Ofa; 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="Id46/Ofa" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6FA67C4CEF7; Tue, 7 Apr 2026 01:05:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775523942; bh=WgiRHi50zFvHwjFSQiNfyV/FQHY8WOkdhFM9Jv3jqj0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Id46/OfaAZ00K5ClvIVUWb6pW1AehlQgKQuwbUeY7+YOgQfpDGSijPvJLSfqp37RA rWgC40yAyYcZv5yGsVW3utBVGld+73Kg/2Sl3snA21zEPhfoia88/Fl2slMRwpbzYd /RA3TZsaNzn5PtV2lLkGbyscD9adNDo26ijcaxEAYSzDmOnEB4K8OyUlveFgnEkcxh /cXDwmu68UANFTWVWrPesnpKynchPvDXc/qLLGNv7vrlN9beoeWgKw5PmRLBrJCQiS 2HWmyh/lTkoYqAS6WNFjgqJQT8H/RNw9e58pQY+x0nYikRrQ0V8tqIJYknZ5/xvGsk qKFKS94nyS3ZA== From: SeongJae Park To: Cc: SeongJae Park , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH v3 06/10] Docs/ABI/damon: document fail_charge_{num,denom} Date: Mon, 6 Apr 2026 18:05:28 -0700 Message-ID: <20260407010536.83603-7-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260407010536.83603-1-sj@kernel.org> References: <20260407010536.83603-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Update DAMON ABI document for the DAMOS action failed regions quota charge ratio control sysfs files. Signed-off-by: SeongJae Park --- Documentation/ABI/testing/sysfs-kernel-mm-damon | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-kernel-mm-damon b/Documentatio= n/ABI/testing/sysfs-kernel-mm-damon index 7059f540940f0..971c22e34e722 100644 --- a/Documentation/ABI/testing/sysfs-kernel-mm-damon +++ b/Documentation/ABI/testing/sysfs-kernel-mm-damon @@ -329,6 +329,18 @@ Contact: SeongJae Park Description: Writing to and reading from this file sets and gets the goal-based effective quota auto-tuning algorithm to use. =20 +What: /sys/kernel/mm/damon/admin/kdamonds//contexts//schemes//qu= otas/fail_charge_num +Date: Mar 2026 +Contact: SeongJae Park +Description: Writing to and reading from this file sets and gets the + action-failed memory quota charging ratio numerator. + +What: /sys/kernel/mm/damon/admin/kdamonds//contexts//schemes//qu= otas/fail_charge_denom +Date: Mar 2026 +Contact: SeongJae Park +Description: Writing to and reading from this file sets and gets the + action-failed memory quota charging ratio denominator. + What: /sys/kernel/mm/damon/admin/kdamonds//contexts//schemes//qu= otas/weights/sz_permil Date: Mar 2022 Contact: SeongJae Park --=20 2.47.3 From nobody Sun Jun 14 22:57:49 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 430532222AC; Tue, 7 Apr 2026 01:05:43 +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=1775523943; cv=none; b=QIb0RU4B++OQYWyi/zhbzssVTh44bxDlumL/fUjy1emA75SNrpARzVEDnUWFAHLy8GjMiULdWnESrWqfMju+3Kc2p5fIyYUmeNOlTUEuwOQj23+ZlyYR0i3JVrmrlmrtJawZNzY7Cl5EBZTHtsWOCvQvmzPpsZ5djc9PM4ugoNQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775523943; c=relaxed/simple; bh=oBXW5uIN8lzshHczxlHFHeX8VLmiX/5T2Hz8N+WZ/sY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bDZhukp1gw0x7hGnvFwHlgo93YZn59wdO+l3X/zA7jHLjPps/8c0l/uPb/tBIjlLH+/1w1v3a51eiIp/b199y/JfGgVZiZUlUdTRH5pb/8rrXwWl568m58438CSgGVoUemozjblig4s59I6+A2RK4zrZGYbkiZOyw4MlYYLBmGE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CwkGFAQZ; 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="CwkGFAQZ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD864C19421; Tue, 7 Apr 2026 01:05:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775523943; bh=oBXW5uIN8lzshHczxlHFHeX8VLmiX/5T2Hz8N+WZ/sY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CwkGFAQZhiE2k1HNhGKP3cVgIFKS0tGi/CdixQ8n7LRSFm1QDHjfA7KDwGqaaaW9S 3rzXs/m6sK3LvyXQUb7weap+9k6h9cQPm+NmRRRWyo6PjF+YgYn8Ekl07x428cNiH1 tR1d7Hw4/s0dHtEtJ3Hc3B6tiK+P/IkVow4OWZDk2yS2/l+DcCIvYR2KW9EO+NlbDe NaXADeplG24hgdyg9J8JzfZ3qptLGVHzCk9os9+Sl8wDsTQ9NkCa1d7l1EmLXf049H RJ75H1UrJFZfNZKNXQPhSmFG8iuvliFQIVUKRrDj3fbDs83h8ILyYAXGAxNm2haB1c QkRFaAqy47xig== 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 v3 07/10] mm/damon/tests/core-kunit: test fail_charge_{num,denom} committing Date: Mon, 6 Apr 2026 18:05:29 -0700 Message-ID: <20260407010536.83603-8-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260407010536.83603-1-sj@kernel.org> References: <20260407010536.83603-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Extend damos_test_commit_quotas() kunit test to ensure damos_commit_quota() handles fail_charge_{num,denom} parameters. Signed-off-by: SeongJae Park --- mm/damon/tests/core-kunit.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mm/damon/tests/core-kunit.h b/mm/damon/tests/core-kunit.h index 0030f682b23b7..1b23a22ac04c4 100644 --- a/mm/damon/tests/core-kunit.h +++ b/mm/damon/tests/core-kunit.h @@ -694,6 +694,8 @@ static void damos_test_commit_quota(struct kunit *test) .ms =3D 2, .sz =3D 3, .goal_tuner =3D DAMOS_QUOTA_GOAL_TUNER_CONSIST, + .fail_charge_num =3D 2, + .fail_charge_denom =3D 3, .weight_sz =3D 4, .weight_nr_accesses =3D 5, .weight_age =3D 6, @@ -703,6 +705,8 @@ static void damos_test_commit_quota(struct kunit *test) .ms =3D 8, .sz =3D 9, .goal_tuner =3D DAMOS_QUOTA_GOAL_TUNER_TEMPORAL, + .fail_charge_num =3D 1, + .fail_charge_denom =3D 1024, .weight_sz =3D 10, .weight_nr_accesses =3D 11, .weight_age =3D 12, @@ -717,6 +721,8 @@ static void damos_test_commit_quota(struct kunit *test) KUNIT_EXPECT_EQ(test, dst.ms, src.ms); KUNIT_EXPECT_EQ(test, dst.sz, src.sz); KUNIT_EXPECT_EQ(test, dst.goal_tuner, src.goal_tuner); + KUNIT_EXPECT_EQ(test, dst.fail_charge_num, src.fail_charge_num); + KUNIT_EXPECT_EQ(test, dst.fail_charge_denom, src.fail_charge_denom); KUNIT_EXPECT_EQ(test, dst.weight_sz, src.weight_sz); KUNIT_EXPECT_EQ(test, dst.weight_nr_accesses, src.weight_nr_accesses); KUNIT_EXPECT_EQ(test, dst.weight_age, src.weight_age); --=20 2.47.3 From nobody Sun Jun 14 22:57:49 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9BDA022DFA4; Tue, 7 Apr 2026 01:05:43 +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=1775523943; cv=none; b=jtc/Ohs/uwcPqAHsQC/4Brt2AAAnliHiQxuwsJJs8+uzebKD1U7wFRXTrPuGzvh/pYtZ9o2w5U+VMSgwqJzmmoYTquDTv73rqjoi1IBQBHc5Dpr1KlmA5AVF9yjc29YYktsTQukTFr6d9qdonTxamI+9u3WIXdAaeAUpihlbBsE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775523943; c=relaxed/simple; bh=EIRB4p0R7OQMpXCAySjtmt5LRqO984ojhpZfxIiXyb0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WjrV+TLVkHcR8U9hzSQItGg/TNa7VrSgdi0bUoOxR2A5K6Qz4WUVNVHnUGdmcynj3cqCTlzEJ3ahB0+lK3z3wS2bB3S9lHPNITzrr68DemXIF8DxufX977PFELtgZpo1XxkPeR7LPACHMymYt1gdlcZieNIdbBVV34tAuKIqz4A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ODU85TTZ; 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="ODU85TTZ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3EB1EC2BCAF; Tue, 7 Apr 2026 01:05:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775523943; bh=EIRB4p0R7OQMpXCAySjtmt5LRqO984ojhpZfxIiXyb0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ODU85TTZFKTroXbh8r0wzowseIcB6UbnnIAZwvCjg596LBqHtS4B2P2VMF8DO++xp 9i4el1WvytI0Bb+pqpNW/22vs+gwu1q8gvvBQh7icRxckaDeR3PTqwCnr6lCK209FS YJqWZwCxiMtSZsrqMGQ08yhHIGwiTcLn41+MTks8Fhi2KkOVJPoLKZQhJUyBZstGDc YKMq3altvB5TtX2OkOSNIdCTwIpUS+6m1PQ9jPXkLG/3sSxajMicrOx2GUXNaLHy9+ AJwQaN2AzfFKY5evddqDeXbEtsKAhg4Xk7v/O4IJy49aPax9GHmZFUPDo2BLwAj029 k8+fmjjZw5oSA== 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 v3 08/10] selftests/damon/_damon_sysfs: support failed region quota charge ratio Date: Mon, 6 Apr 2026 18:05:30 -0700 Message-ID: <20260407010536.83603-9-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260407010536.83603-1-sj@kernel.org> References: <20260407010536.83603-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Extend _damon_sysfs.py for DAMOS action failed regions quota charge ratio setup, so that we can add kselftest for the new feature. Signed-off-by: SeongJae Park --- tools/testing/selftests/damon/_damon_sysfs.py | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/damon/_damon_sysfs.py b/tools/testing/= selftests/damon/_damon_sysfs.py index 120b96ecbd741..8b12cc0484405 100644 --- a/tools/testing/selftests/damon/_damon_sysfs.py +++ b/tools/testing/selftests/damon/_damon_sysfs.py @@ -132,14 +132,17 @@ class DamosQuota: goals =3D None # quota goals goal_tuner =3D None # quota goal tuner reset_interval_ms =3D None # quota reset interval + fail_charge_num =3D None + fail_charge_denom =3D None weight_sz_permil =3D None weight_nr_accesses_permil =3D None weight_age_permil =3D None scheme =3D None # owner scheme =20 def __init__(self, sz=3D0, ms=3D0, goals=3DNone, goal_tuner=3D'consist= ', - reset_interval_ms=3D0, weight_sz_permil=3D0, - weight_nr_accesses_permil=3D0, weight_age_permil=3D0): + reset_interval_ms=3D0, fail_charge_num=3D0, fail_charge_d= enom=3D0, + weight_sz_permil=3D0, weight_nr_accesses_permil=3D0, + weight_age_permil=3D0): self.sz =3D sz self.ms =3D ms self.reset_interval_ms =3D reset_interval_ms @@ -151,6 +154,8 @@ class DamosQuota: for idx, goal in enumerate(self.goals): goal.idx =3D idx goal.quota =3D self + self.fail_charge_num =3D fail_charge_num + self.fail_charge_denom =3D fail_charge_denom =20 def sysfs_dir(self): return os.path.join(self.scheme.sysfs_dir(), 'quotas') @@ -197,6 +202,18 @@ class DamosQuota: os.path.join(self.sysfs_dir(), 'goal_tuner'), self.goal_tu= ner) if err is not None: return err + + err =3D write_file( + os.path.join(self.sysfs_dir(), 'fail_charge_num'), + self.fail_charge_num) + if err is not None: + return err + err =3D write_file( + os.path.join(self.sysfs_dir(), 'fail_charge_denom'), + self.fail_charge_denom) + if err is not None: + return err + return None =20 class DamosWatermarks: --=20 2.47.3 From nobody Sun Jun 14 22:57:49 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F27AF23AE9B; Tue, 7 Apr 2026 01:05:43 +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=1775523944; cv=none; b=muKa74tCTsOgv7y4Skctnf2CsYEtO1a7vwb+6YbJ6MNr9wIUy6OBQytBA13L0myjZqEgX9yvBf5uUEp4TWz/CC9aqrHHVcsz4pZ8Gsbb97YdY7l4euzafMo+O2sZT8FnoXSNNN6HrVIzP8r1a4HErAQaiFtVciD6dr80eZldNWA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775523944; c=relaxed/simple; bh=EuOHul4fripHvwsgWhBfbomSmWCRXpHL6QQJMWdANgQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RzLY5UnTnjicMwr6nDXtwzo0ivbqymSZ4HNxX88mVUMpM4m5Y06+N5bQy79opvdj8lvEmV/gvURVwrqq9BIRJnmzoLVfw48idjvK1S+6qK1QZNh+GyWlun3jw+gJg6bU+XtdT/x9RetpVkmp0WDIzvGClqzB0qHdljQGHMm3n1Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mcfFgWl0; 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="mcfFgWl0" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E792C2BC9E; Tue, 7 Apr 2026 01:05:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775523943; bh=EuOHul4fripHvwsgWhBfbomSmWCRXpHL6QQJMWdANgQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mcfFgWl0wSbjxpNVJs8/dkU9XnwsM/Trq3uFVxnc/VzfDu/QnRptO3YCzH1Nd6bKk Sdhu1R79eFEDSYMWVIcXjDRUaV/4HqF0/5FGh1oDPuL/hniuPauNKU56AKFhilUs6h Qd/wzKUY5jZ2GYuiCxde6sEKTFSoUDBUGHxAxj8yurENvKcNLTSEKQugviIyVB1Xgr BgrTRjpsz2pIvswFyA+M37irFMTduQSZ43w/KegrS5uWj60aX/xfnsuQH0HlKtYjFx BQot8LH7qSHFBTK7kVfIXj8b0hy+7A0JiTv7SQgreod8grZMUQyoy8gUZsxaGkf2IH wVGOdLY1mGHGg== 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 v3 09/10] selftests/damon/drgn_dump_damon_status: support failed region quota charge ratio Date: Mon, 6 Apr 2026 18:05:31 -0700 Message-ID: <20260407010536.83603-10-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260407010536.83603-1-sj@kernel.org> References: <20260407010536.83603-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Extend drgn_dump_damon_status.py to dump DAMON internal state for DAMOS action failed regions quota charge ratio, to be able to show if the internal state for the feature is working, with future DAMON selftests. Signed-off-by: SeongJae Park --- tools/testing/selftests/damon/drgn_dump_damon_status.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/testing/selftests/damon/drgn_dump_damon_status.py b/tool= s/testing/selftests/damon/drgn_dump_damon_status.py index 5b90eb8e7ef88..972948e6215f1 100755 --- a/tools/testing/selftests/damon/drgn_dump_damon_status.py +++ b/tools/testing/selftests/damon/drgn_dump_damon_status.py @@ -112,6 +112,8 @@ def damos_quota_to_dict(quota): ['goals', damos_quota_goals_to_list], ['goal_tuner', int], ['esz', int], + ['fail_charge_num', int], + ['fail_charge_denom', int], ['weight_sz', int], ['weight_nr_accesses', int], ['weight_age', int], --=20 2.47.3 From nobody Sun Jun 14 22:57:49 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 97A8624679C; Tue, 7 Apr 2026 01:05:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775523944; cv=none; b=CydIGtGPe5Winm6ILvj4fjEX+oPvqSTJ2nYHXRG7mowtxCcFQu9eb6Yhu71l4AT8vFids5e1L+0/8nxD2lvR5HgNanfnNuHGsZeZzj4OjFpTlaZKWVTPlbBRSu2hW+sdcygPmVFGWUwzZful9KG1ixv+y+75iiOpbSMAu7vfwdo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775523944; c=relaxed/simple; bh=6J24o91UAsIJGEgFo2jYtnFEeYvJuiRUU82+7XJIPqI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=S6zSZCDCQG5UZ093pj83oJ/K4/mDaFF/RxwH1qKjRRY2ePzBn0Jb4+Pb9YOsQ0YogQAJqhCUHeUrF8MT+IU3qlIxkDe/W7BKzHk360mUNX7eBVSOJltlMCOEX02ny6ew4TJMChvbqsrVP8Du0L4SFK88W1+QHHwFtzCJX+VT2l8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=FDwj2FTa; 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="FDwj2FTa" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 08754C19421; Tue, 7 Apr 2026 01:05:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775523944; bh=6J24o91UAsIJGEgFo2jYtnFEeYvJuiRUU82+7XJIPqI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FDwj2FTacxl0kPuumeqvG7CuFJL1N/GOrzdwTpAV0y7ENCUyXq+huiFhSdO2rQv9W YX57PY4xHgxYPi/2WbkX2UE7moPsQSF4r1dzErgfzjZhGc9Xr5WXZajGldx1g6kokb dw0ZoFjNgDxG+pVnMdLPxYhv071lHdMU1pz1FcTXg+YO3eG3tnze44Yc6WZti5ca0H WrU7mzF/+Sa6qAL31Y4LYLLKFpWmYnmdzoEfpEDmt027UKrd4NhKuEWFfILOUAojA1 vkrd2wRMnSn9YfE/T4walOiiYQaVkyLJ1kH34op1yuA5QLM4jlqQkJQ7kedl+KfHht nU/sWnqvM4ewg== 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 v3 10/10] selftests/damon/sysfs.py: test failed region quota charge ratio Date: Mon, 6 Apr 2026 18:05:32 -0700 Message-ID: <20260407010536.83603-11-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260407010536.83603-1-sj@kernel.org> References: <20260407010536.83603-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