mm/damon/core: skip quota score setup when the quota is full

Patch series "mm/damon: improvements in efficiency, error handling,
documents".

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.


This patch (of 4):

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.

Link: https://lore.kernel.org/20260921151547.78472-1-sj@kernel.org
Link: https://lore.kernel.org/20260921151547.78472-2-sj@kernel.org
Signed-off-by: Liew Rui Yan <aethernet65535@gmail.com>
Signed-off-by: SJ Park <sj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: SJ Park <sj@kernel.org>
Cc: Adrian Huang <adrianhuang0701@gmail.com>
Cc: Karthikeyan KS <karthiproffesional@gmail.com>
Cc: Xuewen Wang <wangxuewen@kylinos.cn>
Cc: Zenghui Yu (Huawei) <zenghui.yu@linux.dev>
This commit is contained in:
Liew Rui Yan 2026-09-21 08:15:43 -07:00 committed by Andrew Morton
parent 1c33522820
commit a9799d2d24

View File

@ -3385,6 +3385,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;