linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Enze Li <lienze@kylinos.cn>
To: sj@kernel.org
Cc: damon@lists.linux.dev, linux-mm@kvack.org, lienze@kylinos.cn
Subject: [PATCH] mm/damon: make region calculations more precise
Date: Wed, 21 May 2025 15:07:47 +0800	[thread overview]
Message-ID: <20250521070747.1458270-1-lienze@kylinos.cn> (raw)

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



             reply	other threads:[~2025-05-21  7:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-21  7:07 Enze Li [this message]
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

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=20250521070747.1458270-1-lienze@kylinos.cn \
    --to=lienze@kylinos.cn \
    --cc=damon@lists.linux.dev \
    --cc=linux-mm@kvack.org \
    --cc=sj@kernel.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