[RFC PATCH v1.1 3/9] mm/damon/paddr: respect folio end for DAMOS_STAT
SJ Park <[email protected]> Sun, 2 Aug 2026 09:26:24 -0700
| Newsgroups | dev.linux.lists.damon,org.kernel.vger.linux-kernel,org.kernel.vger.stable,org.kvack.linux-mm |
|---|---|
| Message-ID | <[email protected]> |
The function for applying DAMOS_STAT in DAMON physical address space
operation set (paddr), namely damon_pa_stat(), applies DAMOS filters to
folios of the given region. For that, it gets folios of addresses in
the region. It starts from the region start address and advances the
address by the size of the folio of the address until it goes out of the
region. If the start address is in the middle of a large folio, and if
the next folios are small, some of the next folios could be skipped. Fix
the issue by advancing the address to exactly the start address of the
next folio.
The user impact is that the DAMOS_STAT-based page level monitoring
results become inaccurate. Since the page level monitoring is supposed
to provide relatively high precision, this is definitely a problem. It
is arguably not critical since it is only monitoring quality
degradation.
Fixes: bdbe1d7bc325 ("mm/damon/paddr: increment pa_stat damon address range by folio size")
Cc: <[email protected]> # 6.14.x
Signed-off-by: SJ Park <[email protected]>
---
mm/damon/paddr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c
index 5c6c3a597fd0b..2ab7b3842701e 100644
--- a/mm/damon/paddr.c
+++ b/mm/damon/paddr.c
@@ -379,7 +379,7 @@ static unsigned long damon_pa_stat(struct damon_region *r,
if (!damos_pa_filter_out(s, folio))
*sz_filter_passed += folio_size(folio) / addr_unit;
- addr += folio_size(folio);
+ addr = PFN_PHYS(folio_pfn(folio)) + folio_size(folio);
folio_put(folio);
}
s->last_applied = folio;
--
2.47.3