summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShu Anzai <shu17az@gmail.com>2025-12-24 07:21:58 +0300
committerAndrew Morton <akpm@linux-foundation.org>2026-01-21 06:24:53 +0300
commit65a17a3e609f63c7ea2887096dc232a6c05d02a2 (patch)
tree0264d2e9b3a31a26983f2d38529d1cc5bef12186
parent738dae96b2fb69c15c99f95ed0044bc12830dcba (diff)
downloadlinux-65a17a3e609f63c7ea2887096dc232a6c05d02a2.tar.xz
mm/damon/tests/core-kunit: add a test case for region merge size limit in damon_test_merge_regions_of()
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. Link: https://lkml.kernel.org/r/20251224042200.2061847-4-shu17az@gmail.com Signed-off-by: Shu Anzai <shu17az@gmail.com> Reviewed-by: SeongJae Park <sj@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
-rw-r--r--mm/damon/tests/core-kunit.h16
1 files 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]);