linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/damon: make region calculations more precise
@ 2025-05-21  7:07 Enze Li
  2025-05-21 17:18 ` SeongJae Park
  2025-05-29  5:53 ` kernel test robot
  0 siblings, 2 replies; 6+ messages in thread
From: Enze Li @ 2025-05-21  7:07 UTC (permalink / raw)
  To: sj; +Cc: damon, linux-mm, lienze

The damon_sz_region() function misses counting one element when
calculating region size, which leads to inaccurate results.  This patch
corrects the size calculation by properly accounting for all elements.

Signed-off-by: Enze Li <lienze@kylinos.cn>
---
 include/linux/damon.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/damon.h b/include/linux/damon.h
index 47e36e6ea203..70473863f7fe 100644
--- a/include/linux/damon.h
+++ b/include/linux/damon.h
@@ -808,7 +808,7 @@ static inline struct damon_region *damon_first_region(struct damon_target *t)
 
 static inline unsigned long damon_sz_region(struct damon_region *r)
 {
-	return r->ar.end - r->ar.start;
+	return r->ar.end - r->ar.start + 1;
 }
 
 

base-commit: 4a95bc121ccdaee04c4d72f84dbfa6b880a514b6
-- 
2.43.0



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

end of thread, other threads:[~2025-05-29 16:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-05-21  7:07 [PATCH] mm/damon: make region calculations more precise Enze Li
2025-05-21 17:18 ` SeongJae Park
2025-05-22  1:53   ` Enze Li
2025-05-22 17:16     ` SeongJae Park
2025-05-29  5:53 ` kernel test robot
2025-05-29 16:41   ` SeongJae Park

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