From nobody Sun Jun 14 18:57:05 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 6EE43280309; Sun, 5 Apr 2026 15:12:37 +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=1775401957; cv=none; b=lEyiqzHAWAO3hSKg/Wzm9Ki3VNFFsVBUml+gmW+yZI+R6AGMrhfpD13k37970c7D9p8sVB1zyiyOVvOiBbTCmXf2U4Pk77wlbwvP3djC9pJzt2x6OwNESlnjxeXLPAY9ah0+CQMm9aAWIk60tJ1vRyByYLdi6YQHOmb7RkjUyFE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775401957; c=relaxed/simple; bh=9Nwo+bW0ZeePwq2iK6IWWxk1khfaf4AjvqsrcmsSnWo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gBvPSln+ydvfDT0cT0Ylp/tJtLQ82mu4PpYyY6C0nOQBG7cockczUItyo1+20Qy/3LV8QJPlQUJxujCAX/VcXWJ86j6ELNXrT7+l7U6P9DmVfCfex5GjY4FCT5honUsyh2g3v91XhtHnEQXmwG2vCeQ7hrRklXAc8pQyxWowFTc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=AnFboUzK; 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="AnFboUzK" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 222D9C2BCB0; Sun, 5 Apr 2026 15:12:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775401957; bh=9Nwo+bW0ZeePwq2iK6IWWxk1khfaf4AjvqsrcmsSnWo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AnFboUzKa6Jy5pP3gMeQgWFk9sXZwGRiVVQKmGf1UbLYkAsibRq/XKPUwbVsVDGo3 tilB5M5yv8RjXOg0ksSydC+WQcdxLsYBGC5RQOfTUnAXJBvUyfDUj7xA7uyWgpkfzw mALAk1fj8YPEb8ADsh2mFbtTC/jXzv2LrdeCj7+uJkZcyWRwLlQ6HC7TFvgBn18vpf rd/bMnHHOOJzuIEzwGK16Xtmnw3UOp5tZqApuN6NEuG5Mlo8qNjqPY/thNajYUBWWs gE1cQlczKN7Vr1HXT+T1MYfmCISNQxj2bIPuOKQSTb7URMaCMwowV4JEXA4tFIyyZW J8AUjkHj/odmg== From: SeongJae Park To: Cc: SeongJae Park , Andrew Morton , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH v2 1/9] mm/damon/core: introduce failed region quota charge ratio Date: Sun, 5 Apr 2026 08:12:19 -0700 Message-ID: <20260405151232.102690-2-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260405151232.102690-1-sj@kernel.org> References: <20260405151232.102690-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 fe5a4a8d5b294..fdeab474b7456 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 void damos_apply_scheme(struct damon_ctx *c, struct damon_target *t, struct damon_region *r, struct damos *s) { @@ -2098,7 +2117,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_set(quota) && quota->charged_sz >=3D quota->esz) { quota->charge_target_from =3D t; --=20 2.47.3 From nobody Sun Jun 14 18:57:05 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 B6F743081D7; Sun, 5 Apr 2026 15:12:37 +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=1775401957; cv=none; b=NLQtuPL/BHDIyTiLfS1QzqQnNHJnuc3DB3DGFWeooGJmD80qZ7dlwVVc+JlPKySERZ/SgA+Cnb1WV65DHO01izG2vjQdhVWso1mbJcDF3W8dQTBiLetKEMUSBJVJ6PdYTGjAGBnQff7WAEpm8NioArUZ9zHBULe3QRB/8SYlexk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775401957; c=relaxed/simple; bh=F/M9rB5L2tN6LoRT9CXC/JolkzvZc5e3+oNuxF0asr8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=W6qOevfblpzigu2YO9QDT3sdiR16CSKmnKc8S0JDcEAjcMr4Q3Y4EJvqRlXPL5/r4nFOhvCTbT4vQ+xnv5a68SpT9blWT02FoK+Wg0JYcprKMsrE2eueiKPSZmXa1VFz4l7r1wcUq8ZkF2jkFOc3SjF3ARL28h7khx0qJDVHh4Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=d1kfa/Ns; 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="d1kfa/Ns" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70A09C2BC9E; Sun, 5 Apr 2026 15:12:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775401957; bh=F/M9rB5L2tN6LoRT9CXC/JolkzvZc5e3+oNuxF0asr8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d1kfa/Ns3Ym2KfHtxsUwFYe/XWcAKWvFaP2qZzlrKAW3VKX29/wE1s+1eRBZwgNAu r7cAaseHUVs6+nwPzAeOI4/BCxy+R/appQYmNSr1+6Mkm9d6gNQln3L5ItT+lBuved aTsRoMCNd4J4nIJ2IwyVBpUUHVacg+kSMvtE+kHAl2W/rX0wtfaJ+Ryq5DB1TL9iS2 ilk7bovc2OPI+8uNSw+BLPv8c10apW7jhgS3e8z4im2+WWBH9HojOFQlNK9YTPFZ4q uTrcsQMNVjCjNBajSGjZZzIwiesNHE8rWl9Qw7O9AsIw9t9pmk5pUoy5lZ1kzs6ygm tuKb9ssE8UYOA== From: SeongJae Park To: Cc: SeongJae Park , Andrew Morton , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH v2 2/9] mm/damon/sysfs-schemes: implement fail_charge_{num,denom} files Date: Sun, 5 Apr 2026 08:12:20 -0700 Message-ID: <20260405151232.102690-3-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260405151232.102690-1-sj@kernel.org> References: <20260405151232.102690-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 18:57:05 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 891892FE075; Sun, 5 Apr 2026 15:12:38 +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=1775401958; cv=none; b=ki9iT5WxdZnj5rP39nRS+IiWqMb5Od44X9HZF5Vh34y34zncm9MKrny6HR2j/vXIrgsHDmnb3BJ+7kSHvd+aa5WYvySKVpUvxhZ1b9C1GU5dHgzo3YiRxH/EqQQEiVucCabyX58pjauvLuY2D4/1Sbma6UVHAkPAFXqoeSxFUIE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775401958; c=relaxed/simple; bh=wTsJFLfcGLj5hQNAgMMrTSRf9Xxnu3P2tGtJgT/UD5c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mjgPMDEJBjm2uYuT6XRcz+jknkxNR53B84XrHNV82jbxc4rxlK1Wfet2NVdylnilqy8g9TJ6by5TWcxHfDIT+r3JGzeF9tKAQ7S8ePMowlPylOXRqftT96+c6K16tUjOs7sITcU69OYwqrMarm6PMjLlsE1Cy+YfKFFUEQJBs1M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mzFr1nw+; 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="mzFr1nw+" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF2F2C2BCB3; Sun, 5 Apr 2026 15:12:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775401958; bh=wTsJFLfcGLj5hQNAgMMrTSRf9Xxnu3P2tGtJgT/UD5c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mzFr1nw+rcLAXTUg+EVg/b6BBnJx1FjVt1a5qCAYYpmhDWqAjJ3yYdFlWunnzRvam S2v6p9qAsl/T4zATyo8fTQQWF1XnnqP2DDs+3C4Gg6L3PvuBpGt0Q1pgaSutQj2mS0 X/0TJRfkgObnxwaCGZl8o2kJNQ+rGkIKMxsSP5E/oREiCaCWmprOMUmO0dUnIcL3tr HiROrLEK9WGTFhAanhk/cPDPkPyrzuN5l3F6xBiQbWbyETcohQ14/fr9/ri9b2KKPb JpXz/rlhslBtUFC9BhKrMYDu0NSJzmWDP6Zfhkh67TECektmrGRmtX5WWifcYcVTvM kiy6LRyooJu7A== From: SeongJae Park To: Cc: SeongJae Park , "Liam R. Howlett" , Andrew Morton , David Hildenbrand , Jonathan Corbet , Lorenzo Stoakes , Michal Hocko , Mike Rapoport , Shuah Khan , Suren Baghdasaryan , Vlastimil Babka , damon@lists.linux.dev, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH v2 3/9] Docs/mm/damon/design: document fail_charge_{num,denom} Date: Sun, 5 Apr 2026 08:12:21 -0700 Message-ID: <20260405151232.102690-4-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260405151232.102690-1-sj@kernel.org> References: <20260405151232.102690-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 | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Documentation/mm/damon/design.rst b/Documentation/mm/damon/des= ign.rst index 510ec6375178d..3ea9c81b756c8 100644 --- a/Documentation/mm/damon/design.rst +++ b/Documentation/mm/damon/design.rst @@ -572,6 +572,27 @@ 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. + +For example, let's suppose a DAMOS action is applied to a region of 1,000 = MiB +size. The action is successfully applied to only 700 MiB of the region. +``fail_charge_num`` and ``fail_charge_denom`` are set to ``1`` and ``1024`= `, +respectively. Then only 700 MiB and 300 KiB of size (``700 MiB + 300 MiB = * 1 / +1024``) will be charged. + + .. _damon_design_damos_quotas_auto_tuning: =20 Aim-oriented Feedback-driven Auto-tuning --=20 2.47.3 From nobody Sun Jun 14 18:57:05 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 151D130C611; Sun, 5 Apr 2026 15:12:39 +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=1775401959; cv=none; b=QzAA/4fCp4SZwsHFSqp2IyOw+A4Ets0+oCHPONweEA0HiXBNFFyg2fXsxjI9kqEAvYw7F5g2QlRqFihBHtgwgJ7aLlFzV00EfFAELe9/Svmj1EnGWBy2LoJRvjhAhlytjR3nnR0Wbv0kAHiRtS0+qpVnP/9o+OoM+iwEz1tSRS0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775401959; c=relaxed/simple; bh=fJkIAWWlo48QPdeJ9YXUoXHCIlYHiM9shoj6TYfrLSQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=qp4VuTGLloWqdQKoDJaZNn1VSKJxHDDpQYyRl2tLhGU6uQ+C8YNx3geRsB/x8P2CmRwUf8+/0j7g2qMUPehgpBukmCyPG2rKu9tzdFGZhpar/u0nbI8dgR/Q9B3tUTjzUTvAGCBiEy18mhwpCXMQZYLxmZywn/kmYmp9T1vDP5c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=HqRwPwfr; 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="HqRwPwfr" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6FC7CC2BCB4; Sun, 5 Apr 2026 15:12:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775401959; bh=fJkIAWWlo48QPdeJ9YXUoXHCIlYHiM9shoj6TYfrLSQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HqRwPwfrwhJ/63bWf2vkpgwtkqVRe3uYLDEi9gGJjlNCVqjoJxIB7gNGzAHTGUeaR IJzmDqV4oRrrK4Z+gWcpaOCTvUcOUe4iZ6sKXbM4b9LHyRNqoei4lOB6tykPPvvp5I wLDVwCDwFzE+Wd6P9kS1G9yusffe7qEPtk3JgeJcdK7SSVynnN3AlqCqDP8iTe9oz5 oWb2YLy1+3Vu2JXTgFnGC5l/Mc661y4XggMFuhR/vHhntoLSXafb57tlyQpmlgB2aQ kiC5LH5wMM29/RPepVQdkAg1w1L117gR0OrwlXh5xAPTx6DN8c+Q2DzmRha+X6GU5W Og9lNrWXGZ2fQ== From: SeongJae Park To: Cc: SeongJae Park , "Liam R. Howlett" , Andrew Morton , David Hildenbrand , Jonathan Corbet , Lorenzo Stoakes , Michal Hocko , Mike Rapoport , Shuah Khan , Suren Baghdasaryan , Vlastimil Babka , damon@lists.linux.dev, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH v2 4/9] Docs/admin-guide/mm/damon/usage: document fail_charge_{num,denom} files Date: Sun, 5 Apr 2026 08:12:22 -0700 Message-ID: <20260405151232.102690-5-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260405151232.102690-1-sj@kernel.org> References: <20260405151232.102690-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Update DAMON usage document for the DAMOS action failed regions quota charge ratio control sysfs files. Signed-off-by: SeongJae Park --- Documentation/admin-guide/mm/damon/usage.rst | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/Documentation/admin-guide/mm/damon/usage.rst b/Documentation/a= dmin-guide/mm/damon/usage.rst index bfdb717441f05..d5548e460857c 100644 --- a/Documentation/admin-guide/mm/damon/usage.rst +++ b/Documentation/admin-guide/mm/damon/usage.rst @@ -84,7 +84,9 @@ comma (","). =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 = =E2=94=82 sz/min,max =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 = =E2=94=82 nr_accesses/min,max =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 = =E2=94=82 age/min,max - =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 = :ref:`quotas `/ms,bytes,reset_interval_ms,effective_bytes,goa= l_tuner + =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 = :ref:`quotas `/ms,bytes,reset_interval_ms, + =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 = effective_bytes,goal_tuner, + =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 = fail_charge_num,fail_charge_denom =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 = =E2=94=82 weights/sz_permil,nr_accesses_permil,age_permil =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 = =E2=94=82 :ref:`goals `/nr_goals =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 = =E2=94=82 =E2=94=82 0/target_metric,target_value,current_value,nid,path @@ -381,9 +383,10 @@ schemes//quotas/ The directory for the :ref:`quotas ` of the giv= en DAMON-based operation scheme. =20 -Under ``quotas`` directory, five files (``ms``, ``bytes``, -``reset_interval_ms``, ``effective_bytes`` and ``goal_tuner``) and two -directories (``weights`` and ``goals``) exist. +Under ``quotas`` directory, seven files (``ms``, ``bytes``, +``reset_interval_ms``, ``effective_bytes``, ``goal_tuner``, ``fail_charge_= num`` +and ``fail_charge_denom``) and two directories (``weights`` and ``goals``) +exist. =20 You can set the ``time quota`` in milliseconds, ``size quota`` in bytes, a= nd ``reset interval`` in milliseconds by writing the values to the three file= s, @@ -402,6 +405,13 @@ the background design of the feature and the name of t= he selectable algorithms. Refer to :ref:`goals directory ` for the goals setup. =20 +You can set the action-failed memory quota charging ratio by writing the +numerator and the denominator for the ratio to ``fail_charge_num`` and +``fail_charge_denom`` files, respectively. Reading those files will retur= n the +current set values. Refer to :ref:`design +` for more details= of +the ratio feature. + The time quota is internally transformed to a size quota. Between the transformed size quota and user-specified size quota, smaller one is appli= ed. Based on the user-specified :ref:`goal `, the --=20 2.47.3 From nobody Sun Jun 14 18:57:05 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 822C330E82D; Sun, 5 Apr 2026 15:12:39 +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=1775401959; cv=none; b=Geb7zvfceS8ovoggZDsSdhHrzg07Tv+5QRd8liXNrcT+5s4V2Ckkcn3mOvxO1lCungI/P1HQ/AmbUDCJJN1PNTj9MfH5gSYP7ucIjRERZh+rxthQmhzHvFIVOX6zdsVDcMW5XCm+iiM8kGoBb8/TaYoAkxwnbcyAtMlyRsk/GtU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775401959; c=relaxed/simple; bh=WgiRHi50zFvHwjFSQiNfyV/FQHY8WOkdhFM9Jv3jqj0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=spGdmUib/j/5+HgIwt3TZYrgi0R7MTXVtogEXIJCMCy7qYSVpp0EPFs5abg1yrqfpQM4AhLZPJ6FvoT1ajH93+Zez3sjG9GuwkZJQySHJuoOfgz2LWvuAos9pwVKgC9CzRHAYFcjVrrSxlDvRkrtChI4W8LKbINQ6nsO+pCe6UU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=fvmM9ifR; 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="fvmM9ifR" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E84AC116C6; Sun, 5 Apr 2026 15:12:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775401959; bh=WgiRHi50zFvHwjFSQiNfyV/FQHY8WOkdhFM9Jv3jqj0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fvmM9ifRdqTUlbXZYONJVHYmVCM4l2anuYGYIg+r2Pviuj0/hKVDWOlJGIOcqIG9k vI4PTFaOH3/jsI2TQMiIqX01w60c8fAhKHQLAKftkWzSS3q5+uZnMuxTa8FGn7ZBzB Btd3uLanbnFzBXAIdusN+gZNVIdpI7bOkdBIAgITYVoiT6aYlg74KxroWgm5wCY+UW faP86iiDJA2elH6BylyItD6jnqXtJQmE9kbt1mHC37RI9swAoYm42ZXtAUgZxtT89M xy6nJE7GMlRC0GQBQX9wjOQH4kyw+Vq9XtmpKp4svvWRVGu5A0l46YUbfTqvmZh4bM o5jjGIjPyMm5g== From: SeongJae Park To: Cc: SeongJae Park , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH v2 5/9] Docs/ABI/damon: document fail_charge_{num,denom} Date: Sun, 5 Apr 2026 08:12:23 -0700 Message-ID: <20260405151232.102690-6-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260405151232.102690-1-sj@kernel.org> References: <20260405151232.102690-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Update DAMON ABI document for the DAMOS action failed regions quota charge ratio control sysfs files. Signed-off-by: SeongJae Park --- Documentation/ABI/testing/sysfs-kernel-mm-damon | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-kernel-mm-damon b/Documentatio= n/ABI/testing/sysfs-kernel-mm-damon index 7059f540940f0..971c22e34e722 100644 --- a/Documentation/ABI/testing/sysfs-kernel-mm-damon +++ b/Documentation/ABI/testing/sysfs-kernel-mm-damon @@ -329,6 +329,18 @@ Contact: SeongJae Park Description: Writing to and reading from this file sets and gets the goal-based effective quota auto-tuning algorithm to use. =20 +What: /sys/kernel/mm/damon/admin/kdamonds//contexts//schemes//qu= otas/fail_charge_num +Date: Mar 2026 +Contact: SeongJae Park +Description: Writing to and reading from this file sets and gets the + action-failed memory quota charging ratio numerator. + +What: /sys/kernel/mm/damon/admin/kdamonds//contexts//schemes//qu= otas/fail_charge_denom +Date: Mar 2026 +Contact: SeongJae Park +Description: Writing to and reading from this file sets and gets the + action-failed memory quota charging ratio denominator. + What: /sys/kernel/mm/damon/admin/kdamonds//contexts//schemes//qu= otas/weights/sz_permil Date: Mar 2022 Contact: SeongJae Park --=20 2.47.3 From nobody Sun Jun 14 18:57:05 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 CADA030F55F; Sun, 5 Apr 2026 15:12:39 +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=1775401959; cv=none; b=AKwCWeCSoGwGk9G1N4aw0BJ7huihPWixq6HPsjM8R1/pTKSBA4yHL0CTn7hGfanXmxBIGBYPp9G8GA4Ueut97H3XPK0Xj1ZyVi4jSrPLbKE5aHh03ADnZ9lNsTDpU1EipNo3teMRDwOzu1se3BSEkNIv0w1HzijFwGINUeFPMgo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775401959; c=relaxed/simple; bh=oBXW5uIN8lzshHczxlHFHeX8VLmiX/5T2Hz8N+WZ/sY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=H03Xv0x8ZdWEQRKZYd2cJjEI4gIRj7canY4o3EOy6TXm5HnvHYJFpTyl8QlvUjiGRin9iF32aIaiVVmoaTi635MZ3fbwZe02FHT5YWXLlbElIe191WqFNqrRzlTq0s3ycDBe/UEDK/44OgDcjvQxV0xLctlftA6fmVmZWBBSISQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=eD82keew; 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="eD82keew" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6509AC2BC9E; Sun, 5 Apr 2026 15:12:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775401959; bh=oBXW5uIN8lzshHczxlHFHeX8VLmiX/5T2Hz8N+WZ/sY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eD82keewiduJmKNLZkUPSOij2QOxI9toUc2chAgEsod36Q3LIs7GT0+v/U3jGdX4b VokqFJL5gjG74PhVbRkTNZWHkZ5ejFixOhY+Z5HbNs2SO7qyH91QcE8xK18w34ylfA E339PY7luvs4xCHiLWfnGNzohUgOJ4Fl6PXZSM79VH5JmQUGf1E52icWaDVZpeMjN5 6S8nPmysv+3lT+ghnqKgXUrdrkUZj/mmPyO8AvGOqQYVWe4b956LduKbdgwP7W62JK abG600lmYNzTDOm8NhXWNhluvlCw5wX8NhzRJIJDYWPI45xO/XRHPn8OH1Rsow3pZd 0Ssy39EBcA90g== 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 v2 6/9] mm/damon/tests/core-kunit: test fail_charge_{num,denom} committing Date: Sun, 5 Apr 2026 08:12:24 -0700 Message-ID: <20260405151232.102690-7-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260405151232.102690-1-sj@kernel.org> References: <20260405151232.102690-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Extend damos_test_commit_quotas() kunit test to ensure damos_commit_quota() handles fail_charge_{num,denom} parameters. Signed-off-by: SeongJae Park --- mm/damon/tests/core-kunit.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mm/damon/tests/core-kunit.h b/mm/damon/tests/core-kunit.h index 0030f682b23b7..1b23a22ac04c4 100644 --- a/mm/damon/tests/core-kunit.h +++ b/mm/damon/tests/core-kunit.h @@ -694,6 +694,8 @@ static void damos_test_commit_quota(struct kunit *test) .ms =3D 2, .sz =3D 3, .goal_tuner =3D DAMOS_QUOTA_GOAL_TUNER_CONSIST, + .fail_charge_num =3D 2, + .fail_charge_denom =3D 3, .weight_sz =3D 4, .weight_nr_accesses =3D 5, .weight_age =3D 6, @@ -703,6 +705,8 @@ static void damos_test_commit_quota(struct kunit *test) .ms =3D 8, .sz =3D 9, .goal_tuner =3D DAMOS_QUOTA_GOAL_TUNER_TEMPORAL, + .fail_charge_num =3D 1, + .fail_charge_denom =3D 1024, .weight_sz =3D 10, .weight_nr_accesses =3D 11, .weight_age =3D 12, @@ -717,6 +721,8 @@ static void damos_test_commit_quota(struct kunit *test) KUNIT_EXPECT_EQ(test, dst.ms, src.ms); KUNIT_EXPECT_EQ(test, dst.sz, src.sz); KUNIT_EXPECT_EQ(test, dst.goal_tuner, src.goal_tuner); + KUNIT_EXPECT_EQ(test, dst.fail_charge_num, src.fail_charge_num); + KUNIT_EXPECT_EQ(test, dst.fail_charge_denom, src.fail_charge_denom); KUNIT_EXPECT_EQ(test, dst.weight_sz, src.weight_sz); KUNIT_EXPECT_EQ(test, dst.weight_nr_accesses, src.weight_nr_accesses); KUNIT_EXPECT_EQ(test, dst.weight_age, src.weight_age); --=20 2.47.3 From nobody Sun Jun 14 18:57:05 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 615FC311C1B; Sun, 5 Apr 2026 15:12: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=1775401960; cv=none; b=e7Tl0mpcRARxPEykK2eEGjEdcOvxOdtS0ORRu+e3K4WNosrPfutGciUkGwPVDsuxbXW27Bk7Z2Yl3Seiru3/+5Og91MfiDLurbTqK2EC6towsfj3UhCH7ir+HbjeGRiC0zzEucVYT2i+mNhCg6qKGwZta4COlPmqFuJg+e2PP4k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775401960; c=relaxed/simple; bh=EIRB4p0R7OQMpXCAySjtmt5LRqO984ojhpZfxIiXyb0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VMaLFIXskX/GJwOm8i+Mq7uKdKiYSbeE4MLaZNRv3J1zEdV8ETfrVqsvdRniG2l1FCWxjt3wWEuv6kf+fxT10pz8lws/SYZiksAmjPuwP2FuBIjRcrlFMxjmUP25mPh0a5H38tStMOVPrbL89sc8+DWn4qN0KnJ6nzjLHzy7nYs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=TBd1tRlR; 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="TBd1tRlR" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D6419C2BCB0; Sun, 5 Apr 2026 15:12:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775401960; bh=EIRB4p0R7OQMpXCAySjtmt5LRqO984ojhpZfxIiXyb0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TBd1tRlRVlUqZHJkb40DOR3rwB5ijHVT51HL8st3yLtEpNxnDr+V5LAgnRMS1h9tc bht0kR/NS2eydwDBc5GlVomCWgRW794wKrHKjCJu0XsfbpaL3D73rhO70ToMAL3vuE avJZQ6i1ArYdQ/FPNjN1ZgO5LVoSGSaDyLJb8P0OSecsfu8p6JPlbg8OFi5Ok+SdXR n+HpS2It8SRcWONBGR0ta44BtwsPw6LVWt+Np+OWz0d1uLG2PpIOfpamR88LKOU7wm wziYjYnsnItV8m9AGxYcLVk33LIIOfM8wK2P/4wXK0f0gqm+OA7SceMsuBaWIv9OT2 NHzZqGLhifP8A== From: SeongJae Park To: Cc: SeongJae Park , Shuah Khan , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH v2 7/9] selftets/damon/_damon_sysfs: support failed region quota charge ratio Date: Sun, 5 Apr 2026 08:12:25 -0700 Message-ID: <20260405151232.102690-8-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260405151232.102690-1-sj@kernel.org> References: <20260405151232.102690-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Extend _damon_sysfs.py for DAMOS action failed regions quota charge ratio setup, so that we can add kselftest for the new feature. Signed-off-by: SeongJae Park --- tools/testing/selftests/damon/_damon_sysfs.py | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/damon/_damon_sysfs.py b/tools/testing/= selftests/damon/_damon_sysfs.py index 120b96ecbd741..8b12cc0484405 100644 --- a/tools/testing/selftests/damon/_damon_sysfs.py +++ b/tools/testing/selftests/damon/_damon_sysfs.py @@ -132,14 +132,17 @@ class DamosQuota: goals =3D None # quota goals goal_tuner =3D None # quota goal tuner reset_interval_ms =3D None # quota reset interval + fail_charge_num =3D None + fail_charge_denom =3D None weight_sz_permil =3D None weight_nr_accesses_permil =3D None weight_age_permil =3D None scheme =3D None # owner scheme =20 def __init__(self, sz=3D0, ms=3D0, goals=3DNone, goal_tuner=3D'consist= ', - reset_interval_ms=3D0, weight_sz_permil=3D0, - weight_nr_accesses_permil=3D0, weight_age_permil=3D0): + reset_interval_ms=3D0, fail_charge_num=3D0, fail_charge_d= enom=3D0, + weight_sz_permil=3D0, weight_nr_accesses_permil=3D0, + weight_age_permil=3D0): self.sz =3D sz self.ms =3D ms self.reset_interval_ms =3D reset_interval_ms @@ -151,6 +154,8 @@ class DamosQuota: for idx, goal in enumerate(self.goals): goal.idx =3D idx goal.quota =3D self + self.fail_charge_num =3D fail_charge_num + self.fail_charge_denom =3D fail_charge_denom =20 def sysfs_dir(self): return os.path.join(self.scheme.sysfs_dir(), 'quotas') @@ -197,6 +202,18 @@ class DamosQuota: os.path.join(self.sysfs_dir(), 'goal_tuner'), self.goal_tu= ner) if err is not None: return err + + err =3D write_file( + os.path.join(self.sysfs_dir(), 'fail_charge_num'), + self.fail_charge_num) + if err is not None: + return err + err =3D write_file( + os.path.join(self.sysfs_dir(), 'fail_charge_denom'), + self.fail_charge_denom) + if err is not None: + return err + return None =20 class DamosWatermarks: --=20 2.47.3 From nobody Sun Jun 14 18:57:05 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 A4ADF31326C; Sun, 5 Apr 2026 15:12: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=1775401960; cv=none; b=UUEsqoosYIAqE9IYUWKBt53BoiHbgwm3uPVz8HrVJjo8yBa8rbmGVYoT8yC39ZHmXNAcmWcje5pQntsKsdE5cTd/4dKrWetsnuwiUo+Ij8bx1UIclWCoaE6/2Y39Nv2oF6hwW7RFO89/xwKRLAHvkUIkubG+yYZYB99jAf1nBEQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775401960; c=relaxed/simple; bh=EuOHul4fripHvwsgWhBfbomSmWCRXpHL6QQJMWdANgQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hfAwNQKBJGrTlI3lUk/RLWXGzSLOIGgKfrdxyABbfTCzFcaa9jZEtYu3CgPXc+Nl6wAMAtQmKaUovPKKd/naFHTG2bg710Z4iQzfln6tZra+1EBBKgimmgmlNJdmmm6Q1t1lSpZWZeX+1ngkweTjQiiukI9dNbU5Na5C8eWltBI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=OAhxzr1b; 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="OAhxzr1b" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A86EC2BCB3; Sun, 5 Apr 2026 15:12:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775401960; bh=EuOHul4fripHvwsgWhBfbomSmWCRXpHL6QQJMWdANgQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OAhxzr1bnG9SRGkzpc/ub0X2fD7lRQkA+jDr+LOlf82Il7d0WZ0uWYwGgfTUH5VZu 0nhkRRCNPT85pSaMyrB5mGedggPtTX94tKYtlUFPsW96kt55LLkDr4vjQ/R6MQvNpZ aifQQXagGzKeQVGaRM3W/UJ2lYk/O88enXmPRbAUl+9iIM7O7+6U3j4vDCASpdj3b3 bSLDvTtrjkJTAxO0DCeS1igoS1EGBNjUu3K6TAB/nm6jEb/j98dYMuG+v1HdFoQISE ABX+N33zGMNfSyZgbCZdou0BWAbEUCXr9KOgoo1HX9E0hdvQftzxQ2LPs0MkIcIPoJ hMWehmld3pwHg== From: SeongJae Park To: Cc: SeongJae Park , Shuah Khan , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH v2 8/9] selftests/damon/drgn_dump_damon_status: support failed region quota charge ratio Date: Sun, 5 Apr 2026 08:12:26 -0700 Message-ID: <20260405151232.102690-9-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260405151232.102690-1-sj@kernel.org> References: <20260405151232.102690-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Extend drgn_dump_damon_status.py to dump DAMON internal state for DAMOS action failed regions quota charge ratio, to be able to show if the internal state for the feature is working, with future DAMON selftests. Signed-off-by: SeongJae Park --- tools/testing/selftests/damon/drgn_dump_damon_status.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/testing/selftests/damon/drgn_dump_damon_status.py b/tool= s/testing/selftests/damon/drgn_dump_damon_status.py index 5b90eb8e7ef88..972948e6215f1 100755 --- a/tools/testing/selftests/damon/drgn_dump_damon_status.py +++ b/tools/testing/selftests/damon/drgn_dump_damon_status.py @@ -112,6 +112,8 @@ def damos_quota_to_dict(quota): ['goals', damos_quota_goals_to_list], ['goal_tuner', int], ['esz', int], + ['fail_charge_num', int], + ['fail_charge_denom', int], ['weight_sz', int], ['weight_nr_accesses', int], ['weight_age', int], --=20 2.47.3 From nobody Sun Jun 14 18:57:05 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 E5D0A314B93; Sun, 5 Apr 2026 15:12: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=1775401961; cv=none; b=X5VW2S2GZ68rqE3wHne41j36J8x6MEDt8azwytG+yub1YYbgV9IouHp75ga8vFs9tbTJJr8K3cS8o9NGvRHTtAnwXIuSrRhRsoiHPSdr9UOfAPP3PFOF4F67nZotjq+nFd70xOMrDrDdAYY3lCtKZRBoE68UXtQ6S/nFedqEkdM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775401961; c=relaxed/simple; bh=6J24o91UAsIJGEgFo2jYtnFEeYvJuiRUU82+7XJIPqI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Oa8S/Gf/SKYvt6EU8ME8AUgoZX9x6M0CDpV4ugH0IhOdcWmVn0Vy7gGsODz+nqwRYxxaMht+5KME/1KsSbZvf9et/216JA5Yjw16bOCFO3o049FN4O5Xle+3Tujysx6tazZj+pNki1z7eM7JY7ctgIWn1xtuKIpkRSQ8WCGTQXU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=h2kMOVNR; 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="h2kMOVNR" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 93460C116C6; Sun, 5 Apr 2026 15:12:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775401960; bh=6J24o91UAsIJGEgFo2jYtnFEeYvJuiRUU82+7XJIPqI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h2kMOVNRWSW6XjBLcKnf8r1Yhmubg+RSZg8ZAJ5XrBACZASdZwQHw2VvOMI5n08Pl QDu+yi2V86xvB7440s527202C9AyrCoNXba+rdi3JqH2m9KFnfYbkJcYdg7Pky2eF0 m3sQvq6g6cIeTrCG9j/jA3P5QKqsjHlnZgbl8dx8e+V4F+srMV/e3vWOTiVcLU79yS N9ZxL7Ci9yAZGNs5tecXu2efi8n/WPMmCqkRnvkmt+XkTogY7LTrzFZq9gBLGq5rUK R4rJ3ArHQaMavK8CSvNssWb6gObIrf+fAcwMb5g5+0ZDD/sN+3YO4DhGreOjizWoDU KGx7iYhCbmF6w== From: SeongJae Park To: Cc: SeongJae Park , Shuah Khan , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH v2 9/9] selftets/damon/sysfs.py: test failed region quota charge ratio Date: Sun, 5 Apr 2026 08:12:27 -0700 Message-ID: <20260405151232.102690-10-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260405151232.102690-1-sj@kernel.org> References: <20260405151232.102690-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