Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: SJ Park <sj@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Aveline Noir <jm5905938@gmail.com>, SJ Park <sj@kernel.org>,
	damon@lists.linux.dev, linux-mm@kvack.org
Subject: [PATCH 2/4] mm/damon/core: skip apply_probes() when no probes are installed
Date: Tue, 24 Nov 2026 07:30:18 -0800	[thread overview]
Message-ID: <20261124153021.90142-3-sj@kernel.org> (raw)
In-Reply-To: <20261124153021.90142-1-sj@kernel.org>

From: Aveline Noir <jm5905938@gmail.com>

While measuring vaddr monitoring overhead, I noticed that kdamond calls
apply_probes() every sampling interval even if no probes are installed.
The vaddr callback walks the page tables for each region's sample, and
paddr looks up a folio and takes a reference if it can. There are no
probe hits to count in either case.

Skip the callback when the probe list is empty. Ordinary access checks
still run, and installed probes with zero weight are still applied.

Signed-off-by: Aveline Noir <jm5905938@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/20261119-damon-skip-empty-probes-20261119-v1-1-ec3e81c1f26b@gmail.com
- Collect R-b: from SJ.
- Rebase to the latest mm-new.

 mm/damon/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/damon/core.c b/mm/damon/core.c
index 649a4ac968abf..74058af5567fe 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -4105,7 +4105,7 @@ static int kdamond_fn(void *data)
 
 		if (!access_check_disabled && ctx->ops.check_accesses)
 			max_merge_score = ctx->ops.check_accesses(ctx);
-		if (ctx->ops.apply_probes) {
+		if (ctx->ops.apply_probes && !list_empty(&ctx->probes)) {
 			if (time_after_eq(ctx->passed_sample_intervals,
 						next_aggregation_sis) &&
 					access_check_disabled)
-- 
2.47.3


  parent reply	other threads:[~2026-11-24 15:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24 15:30 [PATCH 0/4] mm/damon: improve efficiency (paddr, core), fix a selftest, add a kunit SJ Park
2026-11-24 15:30 ` [PATCH 1/4] mm/damon/paddr: skip non-LRU folios as a whole in pageout SJ Park
2026-11-24 15:30 ` SJ Park [this message]
2026-11-24 15:30 ` [PATCH 3/4] selftests/damon/damos_quota: skip the last sample when counting exceeds SJ Park
2026-11-24 15:30 ` [PATCH 4/4] mm/damon/tests/core-kunit: add test for damon_call() 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=20261124153021.90142-3-sj@kernel.org \
    --to=sj@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=damon@lists.linux.dev \
    --cc=jm5905938@gmail.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox