linux/tools/testing/selftests/damon/access_memory_even.c
Ba Jing 12833a7323 selftests/damon/access_memory_even: remove unused variables
By reading the code, I found these variables are never referenced in the
code.  Just remove them.

Link: https://lkml.kernel.org/r/20240924021426.1980-1-bajing@cmss.chinamobile.com
Signed-off-by: Ba Jing <bajing@cmss.chinamobile.com>
Reviewed-by: SeongJae Park <sj@kernel.org>
Reviewed-by: Dev Jain <dev.jain@arm.com>
Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2024-11-05 16:56:30 -08:00

40 lines
827 B
C

// SPDX-License-Identifier: GPL-2.0
/*
* Artificial memory access program for testing DAMON.
*
* Receives number of regions and size of each region from user. Allocate the
* regions and repeatedly access even numbered (starting from zero) regions.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
int main(int argc, char *argv[])
{
char **regions;
int nr_regions;
int sz_region;
int i;
if (argc != 3) {
printf("Usage: %s <number> <size (bytes)>\n", argv[0]);
return -1;
}
nr_regions = atoi(argv[1]);
sz_region = atoi(argv[2]);
regions = malloc(sizeof(*regions) * nr_regions);
for (i = 0; i < nr_regions; i++)
regions[i] = malloc(sz_region);
while (1) {
for (i = 0; i < nr_regions; i++) {
if (i % 2 == 0)
memset(regions[i], i, sz_region);
}
}
return 0;
}