Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm/damon/core: skip apply_probes() when no probes are installed
@ 2026-11-19  8:39 Aveline Noir
  2026-11-19 15:20 ` SJ Park
  0 siblings, 1 reply; 2+ messages in thread
From: Aveline Noir @ 2026-11-19  8:39 UTC (permalink / raw)
  To: SJ Park, Andrew Morton; +Cc: damon, linux-mm

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>
---
Tested in x86-64 KVM on 067c5c24cef2. All fvaddr probe checks passed.
---
 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 986404b547eb..df711b6a8d03 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -4089,7 +4089,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)

---
base-commit: 9f004372ebeb18fdeb699f9880a0e472df90135b
change-id: 20261119-damon-skip-empty-probes-20261119-586d76178530

-- 
Thanks,
Aveline Noir



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-19 15:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-19  8:39 [PATCH] mm/damon/core: skip apply_probes() when no probes are installed Aveline Noir
2026-11-19 15:20 ` SJ Park

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox