* [PATCH 0/4] mm/damon: improvements in efficiency, error handling, documents
@ 2026-09-21 15:15 SJ Park
2026-09-21 15:15 ` [PATCH 1/4] mm/damon/core: skip quota score setup when the quota is full SJ Park
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: SJ Park @ 2026-09-21 15:15 UTC (permalink / raw)
To: Andrew Morton
Cc: SJ Park, Adrian Huang, Karthikeyan KS, Liew Rui Yan, Xuewen Wang,
damon, linux-kernel, linux-mm
Four various improvements. Patch 1 from Liew Rui Yan skips unnecessary
quota setup work when relevant. Patch 2 from Xuewen Wang propagates
ignored damon_call() error to sysfs users. Patch 3 from Adrian Huang
(Lenovo) fixes typos in comments. Patch 4 from Karthikeyan KS clarifies
zero sample interval acceptance on kernel-doc comment.
---
Note: this is a batched reposting of DAMON patches that were
individually posted and reviewed by the DAMON maintainer.
Adrian Huang (Lenovo) (1):
mm/damon: fix typos in comments
Karthikeyan KS (1):
mm/damon: document that a zero sample_interval is accepted
Liew Rui Yan (1):
mm/damon/core: skip quota score setup when the quota is full
Xuewen Wang (1):
mm/damon/sysfs: propagate damon_call() error in turn_damon_on
include/linux/damon.h | 3 ++-
mm/damon/core.c | 8 +++++---
mm/damon/lru_sort.c | 2 +-
mm/damon/sysfs.c | 3 ++-
4 files changed, 10 insertions(+), 6 deletions(-)
base-commit: 05b2dd9725f76b0024d387ed2226d1ab531620ce
--
2.47.3
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/4] mm/damon/core: skip quota score setup when the quota is full
2026-09-21 15:15 [PATCH 0/4] mm/damon: improvements in efficiency, error handling, documents SJ Park
@ 2026-09-21 15:15 ` SJ Park
2026-09-21 15:15 ` [PATCH 2/4] mm/damon/sysfs: propagate damon_call() error in turn_damon_on SJ Park
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: SJ Park @ 2026-09-21 15:15 UTC (permalink / raw)
To: Andrew Morton
Cc: Liew Rui Yan, Adrian Huang, Karthikeyan KS, SJ Park, Xuewen Wang,
damon, linux-kernel, linux-mm
From: Liew Rui Yan <aethernet65535@gmail.com>
In damos_adjust_quota(), the quota could already be full.
In this situation, damos_adjust_quota() will still calculates
quota->min_score. However, this min_score will not be used in this
window, because in damon_do_apply_schemes(), damos_quota_is_full() will
always returns true, preventing the scheme from being applied to any
region.
Therefore, add a short circuit for 'esz < min_region_sz' schemes to
early return from damos_adjust_quota() before calculating min_score.
Signed-off-by: Liew Rui Yan <aethernet65535@gmail.com>
Reviewed-by: SJ Park <sj@kernel.org>
Signed-off-by: SJ Park <sj@kernel.org>
---
Changes from v1
- v1: https://lore.kernel.org/20260913110407.32558-1-aethernet65535@gmail.com
- Collect R-b: from SJ.
- Rebase to the latest mm-new.
mm/damon/core.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/mm/damon/core.c b/mm/damon/core.c
index 2258b72da7a7..98c767b9e6ef 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -3368,6 +3368,8 @@ static void damos_adjust_quota(struct damon_ctx *c, struct damos *s)
damos_trace_esz(c, s, quota);
}
+ if (damos_quota_is_full(quota, c->min_region_sz))
+ return;
if (!c->ops.get_scheme_score)
return;
--
2.47.3
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/4] mm/damon/sysfs: propagate damon_call() error in turn_damon_on
2026-09-21 15:15 [PATCH 0/4] mm/damon: improvements in efficiency, error handling, documents SJ Park
2026-09-21 15:15 ` [PATCH 1/4] mm/damon/core: skip quota score setup when the quota is full SJ Park
@ 2026-09-21 15:15 ` SJ Park
2026-09-21 15:15 ` [PATCH 3/4] mm/damon: fix typos in comments SJ Park
2026-09-21 15:15 ` [PATCH 4/4] mm/damon: document that a zero sample_interval is accepted SJ Park
3 siblings, 0 replies; 5+ messages in thread
From: SJ Park @ 2026-09-21 15:15 UTC (permalink / raw)
To: Andrew Morton
Cc: Xuewen Wang, Adrian Huang, Karthikeyan KS, Liew Rui Yan, SJ Park,
damon, linux-kernel, linux-mm
From: Xuewen Wang <wangxuewen@kylinos.cn>
damon_sysfs_turn_damon_on() ignored the return value of damon_call()
for the repeat call control registration and always returned the stale
result of damon_start() (0 at that point). When damon_call() fails,
e.g., the kdamond is already exiting, the user still gets success from
the state file write while monitoring is not actually on.
Save and return the damon_call() result instead. No rollback of
damon_start() is needed since a failed damon_call() guarantees the
context is stopped.
Signed-off-by: Xuewen Wang <wangxuewen@kylinos.cn>
Reviewed-by: SJ Park <sj@kernel.org>
Signed-off-by: SJ Park <sj@kernel.org>
---
Changes from v1
- v1: https://lore.kernel.org/20260915093928.3389096-1-wangxuewen@kylinos.cn
- Collect R-b: from SJ.
- Rebase to the latest mm-new.
mm/damon/sysfs.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c
index 43519afb9eb7..70a4b64fb8ea 100644
--- a/mm/damon/sysfs.c
+++ b/mm/damon/sysfs.c
@@ -2607,7 +2607,8 @@ static int damon_sysfs_turn_damon_on(struct damon_sysfs_kdamond *kdamond)
repeat_call_control->data = kdamond;
repeat_call_control->repeat = true;
repeat_call_control->dealloc_on_cancel = true;
- if (damon_call(ctx, repeat_call_control))
+ err = damon_call(ctx, repeat_call_control);
+ if (err)
kfree(repeat_call_control);
return err;
}
--
2.47.3
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 3/4] mm/damon: fix typos in comments
2026-09-21 15:15 [PATCH 0/4] mm/damon: improvements in efficiency, error handling, documents SJ Park
2026-09-21 15:15 ` [PATCH 1/4] mm/damon/core: skip quota score setup when the quota is full SJ Park
2026-09-21 15:15 ` [PATCH 2/4] mm/damon/sysfs: propagate damon_call() error in turn_damon_on SJ Park
@ 2026-09-21 15:15 ` SJ Park
2026-09-21 15:15 ` [PATCH 4/4] mm/damon: document that a zero sample_interval is accepted SJ Park
3 siblings, 0 replies; 5+ messages in thread
From: SJ Park @ 2026-09-21 15:15 UTC (permalink / raw)
To: Andrew Morton
Cc: Adrian Huang (Lenovo),
Karthikeyan KS, Liew Rui Yan, SJ Park, Xuewen Wang, damon,
linux-kernel, linux-mm, Zenghui Yu (Huawei)
From: "Adrian Huang (Lenovo)" <adrianhuang0701@gmail.com>
Correct spelling mistakes. No functional changes.
Signed-off-by: Adrian Huang (Lenovo) <adrianhuang0701@gmail.com>
Reviewed-by: Zenghui Yu (Huawei) <zenghui.yu@linux.dev>
Reviewed-by: SJ Park <sj@kernel.org>
Signed-off-by: SJ Park <sj@kernel.org>
---
Changes from v1
- v1: https://lore.kernel.org/20260915102746.647-1-adrianhuang0701@gmail.com
- Collect R-b: from Zenghui and SJ.
- Rebase to the latest mm-new.
mm/damon/core.c | 6 +++---
mm/damon/lru_sort.c | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/mm/damon/core.c b/mm/damon/core.c
index 98c767b9e6ef..0aa5d0ea8ebc 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -2486,7 +2486,7 @@ static bool damos_valid_target(struct damon_ctx *c, struct damon_region *r,
* This function checks if a given region should be skipped or not for the
* reason. If only the starting part of the region has previously charged,
* this function splits the region into two so that the second one covers the
- * area that not charged in the previous charge widnow, and return true. The
+ * area that not charged in the previous charge window, and return true. The
* caller can see the second one on the next iteration of the region walk.
* Note that this means the caller should use damon_for_each_region() instead
* of damon_for_each_region_safe(). If damon_for_each_region_safe() is used,
@@ -2652,7 +2652,7 @@ static void damos_walk_call_walk(struct damon_ctx *ctx, struct damon_target *t,
* This function is called when kdamond finished applying the action of a DAMOS
* scheme to all regions that eligible for the given &damos->apply_interval_us.
* If every scheme of @ctx including @s now finished walking for at least one
- * &damos->apply_interval_us, this function makrs the handling of the given
+ * &damos->apply_interval_us, this function marks the handling of the given
* DAMOS walk request is done, so that damos_walk() can wake up and return.
*/
static void damos_walk_complete(struct damon_ctx *ctx, struct damos *s)
@@ -4177,7 +4177,7 @@ static bool damon_find_system_rams_range(unsigned long *start,
* This function sets the region of @t as requested by @start and @end. If the
* values of @start and @end are zero, however, this function finds 'System
* RAM' resources and sets the region to cover all the resource. In the latter
- * case, this function saves the start and the end addresseses of the first and
+ * case, this function saves the start and the end addresses of the first and
* the last resources in @start and @end, respectively.
*
* Return: 0 on success, negative error code otherwise.
diff --git a/mm/damon/lru_sort.c b/mm/damon/lru_sort.c
index ad8e86dd3a93..273efa3c913e 100644
--- a/mm/damon/lru_sort.c
+++ b/mm/damon/lru_sort.c
@@ -260,7 +260,7 @@ static int damon_lru_sort_add_filters(struct damos *hot_scheme,
return -ENOMEM;
damos_add_filter(hot_scheme, filter);
- /* disabllow de-prioritizing young pages */
+ /* disallow de-prioritizing young pages */
filter = damos_new_filter(DAMOS_FILTER_TYPE_YOUNG, true, false);
if (!filter)
return -ENOMEM;
--
2.47.3
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 4/4] mm/damon: document that a zero sample_interval is accepted
2026-09-21 15:15 [PATCH 0/4] mm/damon: improvements in efficiency, error handling, documents SJ Park
` (2 preceding siblings ...)
2026-09-21 15:15 ` [PATCH 3/4] mm/damon: fix typos in comments SJ Park
@ 2026-09-21 15:15 ` SJ Park
3 siblings, 0 replies; 5+ messages in thread
From: SJ Park @ 2026-09-21 15:15 UTC (permalink / raw)
To: Andrew Morton
Cc: Karthikeyan KS, Adrian Huang, Liew Rui Yan, SJ Park, Xuewen Wang,
damon, linux-kernel, linux-mm
From: Karthikeyan KS <karthiproffesional@gmail.com>
damon_set_attrs() accepts sample_interval == 0. This was reported as a
bug in v1 of this patch (rejecting it in damon_set_attrs()). A similar
patch was already declined for the same reason: a zero interval is
intentionally supported [1].
Document the behavior instead of changing it.
[1] https://lore.kernel.org/all/20260722094304.3132750-1-dayou5941@163.com/
Signed-off-by: Karthikeyan KS <karthiproffesional@gmail.com>
Reviewed-by: SJ Park <sj@kernel.org>
Signed-off-by: SJ Park <sj@kernel.org>
---
Changes from v2
- v2: https://lore.kernel.org/20260918131301.75879-1-karthiproffesional@gmail.com
- Collect R-b: from SJ.
- Rebas to the latest mm-new.
Changes from v1:
- Dropped the damon_set_attrs() rejection and the KUnit cases that
tested it.
- Added a kernel-doc note on struct damon_attrs's @sample_interval
instead.
include/linux/damon.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/linux/damon.h b/include/linux/damon.h
index 836353c4ab9a..844b175120f0 100644
--- a/include/linux/damon.h
+++ b/include/linux/damon.h
@@ -836,7 +836,8 @@ struct damon_probe {
/**
* struct damon_attrs - Monitoring attributes for accuracy/overhead control.
*
- * @sample_interval: The time between access samplings.
+ * @sample_interval: The time between access samplings. Zero is
+ * accepted.
* @aggr_interval: The time between monitor results aggregations.
* @ops_update_interval: The time between monitoring operations updates.
* @intervals_goal: Intervals auto-tuning goal.
--
2.47.3
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-09-21 15:16 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-21 15:15 [PATCH 0/4] mm/damon: improvements in efficiency, error handling, documents SJ Park
2026-09-21 15:15 ` [PATCH 1/4] mm/damon/core: skip quota score setup when the quota is full SJ Park
2026-09-21 15:15 ` [PATCH 2/4] mm/damon/sysfs: propagate damon_call() error in turn_damon_on SJ Park
2026-09-21 15:15 ` [PATCH 3/4] mm/damon: fix typos in comments SJ Park
2026-09-21 15:15 ` [PATCH 4/4] mm/damon: document that a zero sample_interval is accepted SJ Park
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®