[PATCH 1/8] selftests/damon/access_memory: use user-defined region size

SeongJae Park
2024-06-25T18:05:45Z

'access_memory' is an artificial memory access pattern generator for
DAMON tests. It creates and accesses memory regions that the user
specified the number and size via the command line. However, real
access part of the program ignores the user-specified size of each
region. Instead, it uses a hard-coded value, 10 MiB. Fix it to use
user-defined size.

Note that all existing 'access_memory' users are setting the region size
as 10 MiB. Hence no real problem has happened so far.

Fixes: b5906f5f7359 ("selftests/damon: add a test for update_schemes_tried_regions sysfs command")
Signed-off-by: SeongJae Park <sj@kernel.org>
---
tools/testing/selftests/damon/access_memory.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/damon/access_memory.c b/tools/testing/selftests/damon/access_memory.c
index 585a2fa54329..56b17e8fe1be 100644
--- a/tools/testing/selftests/damon/access_memory.c
+++ b/tools/testing/selftests/damon/access_memory.c
@@ -35,7 +35,7 @@ int main(int argc, char *argv[])
start_clock = clock();
while ((clock() - start_clock) * 1000 / CLOCKS_PER_SEC <
access_time_ms)
- memset(regions[i], i, 1024 * 1024 * 10);
+ memset(regions[i], i, sz_region);
}
return 0;
}
--
2.39.2