[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-24T04:22:19Z

Extend damon_test_merge_two() to verify the 'age' and
'nr_accesses_bp' fields.

Signed-off-by: Shu Anzai <shu17az@gmail.com>
---
mm/damon/tests/core-kunit.h | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/mm/damon/tests/core-kunit.h b/mm/damon/tests/core-kunit.h
index 88ec046f4942..6e301113e103 100644
--- a/mm/damon/tests/core-kunit.h
+++ b/mm/damon/tests/core-kunit.h
@@ -192,6 +192,7 @@ static void damon_test_merge_two(struct kunit *test)
}
r->nr_accesses = 10;
r->nr_accesses_bp = 100000;
+ r->age = 9;
damon_add_region(r, t);
r2 = damon_new_region(100, 300);
if (!r2) {
@@ -200,12 +201,15 @@ static void damon_test_merge_two(struct kunit *test)
}
r2->nr_accesses = 20;
r2->nr_accesses_bp = 200000;
+ r2->age = 21;
damon_add_region(r2, t);

damon_merge_two_regions(t, r, r2);
KUNIT_EXPECT_EQ(test, r->ar.start, 0ul);
KUNIT_EXPECT_EQ(test, r->ar.end, 300ul);
KUNIT_EXPECT_EQ(test, r->nr_accesses, 16u);
+ KUNIT_EXPECT_EQ(test, r->nr_accesses_bp, 160000u);
+ KUNIT_EXPECT_EQ(test, r->age, 17u);

i = 0;
damon_for_each_region(r3, t) {
--
2.43.0