All of lore.kernel.org
 help / color / mirror / Atom feed
From: SJ Park <sj@kernel.org>
Cc: SJ Park <sj@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	damon@lists.linux.dev, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org
Subject: [RFC PATCH v1.2 01/12] mm/damon/core: use damon_nr_samples_per_aggr() for max merge threshold
Date: Wed, 29 Jul 2026 07:02:41 -0700	[thread overview]
Message-ID: <20260729140253.87753-2-sj@kernel.org> (raw)
In-Reply-To: <20260729140253.87753-1-sj@kernel.org>

kdamond_merge_regions() open-codes max region merge threshold
calculation.  What it does is fundamentally the same as
damon_nr_samples_per_aggr() but missing a few corner cases.  The
unhandled corner cases should be rare and make only a negligible level
of monitoring results degradation.  But having the inconsistency could
increase future maintenance burden.  Use the dedicated function.

Signed-off-by: SJ Park <sj@kernel.org>
---
 mm/damon/core.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/mm/damon/core.c b/mm/damon/core.c
index f7c9b94b6436b..4169268d94416 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -3470,8 +3470,7 @@ static void kdamond_merge_regions(struct damon_ctx *c, unsigned int threshold,
 	unsigned int max_thres;
 	bool count_age = true;
 
-	max_thres = c->attrs.aggr_interval /
-		(c->attrs.sample_interval ?  c->attrs.sample_interval : 1);
+	max_thres = damon_nr_samples_per_aggr(&c->attrs);
 	while (true) {
 		nr_regions = 0;
 		damon_for_each_target(t, c) {
-- 
2.47.3

  reply	other threads:[~2026-07-29 14:03 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-29 14:02 [RFC PATCH v1.2 00/12] mm/damon: cleanup code, add test cases, and update guidances in docs SJ Park
2026-07-29 14:02 ` SJ Park [this message]
2026-07-29 14:02 ` [RFC PATCH v1.2 02/12] mm/damon/core: remove debug messages SJ Park
2026-07-29 14:02 ` [RFC PATCH v1.2 03/12] mm/damon/vaddr: remove a debug message SJ Park
2026-07-29 14:02 ` [RFC PATCH v1.2 04/12] mm/damon/core: validate number of probes in valid_probe_params() SJ Park
2026-07-29 14:02 ` [RFC PATCH v1.2 05/12] mm/damon/sysfs: remove probes number validation SJ Park
2026-07-29 14:16   ` sashiko-bot
2026-07-29 14:24     ` SJ Park
2026-07-29 14:02 ` [RFC PATCH v1.2 06/12] mm/damon/tests/core-kunit: extend set_regions() test for error case SJ Park
2026-07-29 14:02 ` [RFC PATCH v1.2 07/12] mm/damon/tests/core-kunit: test <=0 size damon_set_regions() inputs SJ Park
2026-07-29 14:02 ` [RFC PATCH v1.2 08/12] mm/damon/tests/core-kunit: test overlapping ranges for set_regions() SJ Park
2026-07-29 14:02 ` [RFC PATCH v1.2 09/12] mm/damon/tests/core-kunit: test damon_nr_samples_per_aggr() SJ Park
2026-07-29 14:02 ` [RFC PATCH v1.2 10/12] selftests/damon/sysfs.sh: test hugepage_mem_bp quota goal SJ Park
2026-07-29 14:02 ` [RFC PATCH v1.2 11/12] Docs/mm/damon/maintainer-profile: update AI review for Sashiko replies SJ Park
2026-07-29 14:02 ` [RFC PATCH v1.2 12/12] Docs/ABI/damon: recommend subsystem doc instead of admin-guide SJ Park

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260729140253.87753-2-sj@kernel.org \
    --to=sj@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=damon@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.