From: Shu Anzai <shu17az@gmail.com>
To: SeongJae Park <sj@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
damon@lists.linux.dev, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, Shu Anzai <shu17az@gmail.com>
Subject: [PATCH v2 3/5] mm/damon/tests/core-kunit: add a test case for region merge size limit in damon_test_merge_regions_of()
Date: Wed, 24 Dec 2025 04:21:58 +0000 [thread overview]
Message-ID: <20251224042200.2061847-4-shu17az@gmail.com> (raw)
In-Reply-To: <20251224042200.2061847-1-shu17az@gmail.com>
Add a test case in damon_test_merge_regions_of() to verify that
two adjacent regions are not merged if the resulting region would
exceed the specified size limit.
Signed-off-by: Shu Anzai <shu17az@gmail.com>
---
mm/damon/tests/core-kunit.h | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/mm/damon/tests/core-kunit.h b/mm/damon/tests/core-kunit.h
index 6e301113e103..2eb6f41635a8 100644
--- a/mm/damon/tests/core-kunit.h
+++ b/mm/damon/tests/core-kunit.h
@@ -238,12 +238,12 @@ static void damon_test_merge_regions_of(struct kunit *test)
{
struct damon_target *t;
struct damon_region *r;
- unsigned long sa[] = {0, 100, 114, 122, 130, 156, 170, 184};
- unsigned long ea[] = {100, 112, 122, 130, 156, 170, 184, 230};
- unsigned int nrs[] = {0, 0, 10, 10, 20, 30, 1, 2};
+ unsigned long sa[] = {0, 100, 114, 122, 130, 156, 170, 184, 230};
+ unsigned long ea[] = {100, 112, 122, 130, 156, 170, 184, 230, 10170};
+ unsigned int nrs[] = {0, 0, 10, 10, 20, 30, 1, 2, 5};
- unsigned long saddrs[] = {0, 114, 130, 156, 170};
- unsigned long eaddrs[] = {112, 130, 156, 170, 230};
+ unsigned long saddrs[] = {0, 114, 130, 156, 170, 230};
+ unsigned long eaddrs[] = {112, 130, 156, 170, 230, 10170};
int i;
t = damon_new_target();
@@ -261,9 +261,9 @@ static void damon_test_merge_regions_of(struct kunit *test)
}
damon_merge_regions_of(t, 9, 9999);
- /* 0-112, 114-130, 130-156, 156-170 */
- KUNIT_EXPECT_EQ(test, damon_nr_regions(t), 5u);
- for (i = 0; i < 5; i++) {
+ /* 0-112, 114-130, 130-156, 156-170, 170-230, 230-10170 */
+ KUNIT_EXPECT_EQ(test, damon_nr_regions(t), 6u);
+ for (i = 0; i < 6; i++) {
r = __nth_region_of(t, i);
KUNIT_EXPECT_EQ(test, r->ar.start, saddrs[i]);
KUNIT_EXPECT_EQ(test, r->ar.end, eaddrs[i]);
--
2.43.0
next prev parent reply other threads:[~2025-12-24 4:22 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-24 4:21 [PATCH v2 0/5] mm/damon/tests/core-kunit: extend existing test scenarios Shu Anzai
2025-12-24 4:21 ` [PATCH v2 1/5] mm/damon/tests/core-kunit: verify the 'age' field in damon_test_split_at() Shu Anzai
2025-12-24 5:26 ` SeongJae Park
2025-12-24 4:21 ` [PATCH v2 2/5] mm/damon/tests/core-kunit: verify the 'age' and 'nr_accesses_bp' fields in damon_test_merge_two() Shu Anzai
2025-12-24 5:27 ` SeongJae Park
2025-12-24 4:21 ` Shu Anzai [this message]
2025-12-24 5:29 ` [PATCH v2 3/5] mm/damon/tests/core-kunit: add a test case for region merge size limit in damon_test_merge_regions_of() SeongJae Park
2025-12-24 4:21 ` [PATCH v2 4/5] mm/damon/tests/core-kunit: add test cases for multiple regions in damon_test_split_regions_of() Shu Anzai
2025-12-24 5:34 ` SeongJae Park
2025-12-24 15:31 ` SeongJae Park
2025-12-24 4:22 ` [PATCH v2 5/5] mm/damon/tests/core-kunit: remove a redundant test case and add a new test case in damos_test_commit_quota_goal() Shu Anzai
2025-12-24 5:35 ` SeongJae Park
2025-12-24 5:38 ` [PATCH v2 0/5] mm/damon/tests/core-kunit: extend existing test scenarios 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=20251224042200.2061847-4-shu17az@gmail.com \
--to=shu17az@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=damon@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--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