All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] mm/damon/ops-common: use nr_accesses moving sum for quota score
@ 2026-07-18 18:01 SJ Park
  0 siblings, 0 replies; only message in thread
From: SJ Park @ 2026-07-18 18:01 UTC (permalink / raw)
  Cc: SJ Park, stable, Andrew Morton, damon, linux-kernel, linux-mm

Since commit 42f994b71404 ("mm/damon/core: implement scheme-specific
apply interval"), DAMOS scheme can be applied at any time.  At that
time, nr_accesses may not be fully aggregated.  But the quota
prioritization score is calculated using the not fully aggregated count.
As a result, the performance of DAMOS could be degraded.  Fix by using
damon_nr_accesses_mvsum() instead.

The user impact is suboptimum DAMOS performance under certain setups.
The issue was there from the beginning of the setup availability.  Hence
it was the baseline for the setup.  Probably that's why people didn't
notice the suboptimality so far.

Fixes: 42f994b71404 ("mm/damon/core: implement scheme-specific apply interval")
Cc: <stable@vger.kernel.org> # 6.7.x
Signed-off-by: SJ Park <sj@kernel.org>
---
Given the user impact, this is not an urgent hotfix in my opinion.  This
is rather a good improvement that is better to eventually be merged into
stable kernels, though.

 mm/damon/ops-common.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/mm/damon/ops-common.c b/mm/damon/ops-common.c
index de9a104e88321..e59f77eca83b2 100644
--- a/mm/damon/ops-common.c
+++ b/mm/damon/ops-common.c
@@ -111,8 +111,9 @@ int damon_hot_score(struct damon_ctx *c, struct damon_region *r,
 	unsigned int age_weight = s->quota.weight_age;
 	int hotness;
 
-	freq_subscore = r->nr_accesses * DAMON_MAX_SUBSCORE /
-		damon_nr_samples_per_aggr(&c->attrs);
+	freq_subscore = mult_frac(damon_nr_accesses_mvsum(r, c),
+			DAMON_MAX_SUBSCORE,
+			damon_nr_samples_per_aggr(&c->attrs));
 
 	age_in_sec = (unsigned long)r->age * c->attrs.aggr_interval / 1000000;
 	if (age_in_sec)

base-commit: 6f1af14da2daf85f73375ffcabcf82255970e2b5
-- 
2.47.3

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-07-18 18:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-18 18:01 [RFC PATCH] mm/damon/ops-common: use nr_accesses moving sum for quota score SJ Park

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.