diff options
| author | Muhammad Usama Anjum <[email protected]> | 2025-07-07 07:33:20 +0000 |
|---|---|---|
| committer | Andrew Morton <[email protected]> | 2025-07-20 01:59:44 +0000 |
| commit | f73858d5ef93cb880aca64d826b4e3ca8b55365a (patch) | |
| tree | 9b506cc5750aa9401172456989755a8a006dff75 /tools/testing/selftests/mm/cow.c | |
| parent | Docs/mm/damon/maintainer-profile: update for mm-new tree (diff) | |
| download | kernel-f73858d5ef93cb880aca64d826b4e3ca8b55365a.tar.gz kernel-f73858d5ef93cb880aca64d826b4e3ca8b55365a.zip | |
selftests/mm: pagemap_scan ioctl: add PFN ZERO test cases
Add test cases to test the correctness of PFN ZERO flag of pagemap_scan
ioctl. Test with normal pages backed memory and huge pages backed memory.
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Muhammad Usama Anjum <[email protected]>
Cc: David Hildenbrand <[email protected]>
Cc: Muhammad Usama Anjum <[email protected]>
Cc: Shuah Khan <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Diffstat (limited to 'tools/testing/selftests/mm/cow.c')
| -rw-r--r-- | tools/testing/selftests/mm/cow.c | 27 |
1 files changed, 1 insertions, 26 deletions
diff --git a/tools/testing/selftests/mm/cow.c b/tools/testing/selftests/mm/cow.c index 29767e2afdd0..788e82b00b75 100644 --- a/tools/testing/selftests/mm/cow.c +++ b/tools/testing/selftests/mm/cow.c @@ -72,31 +72,6 @@ static int detect_thp_sizes(size_t sizes[], int max) return count; } -static void detect_huge_zeropage(void) -{ - int fd = open("/sys/kernel/mm/transparent_hugepage/use_zero_page", - O_RDONLY); - size_t enabled = 0; - char buf[15]; - int ret; - - if (fd < 0) - return; - - ret = pread(fd, buf, sizeof(buf), 0); - if (ret > 0 && ret < sizeof(buf)) { - buf[ret] = 0; - - enabled = strtoul(buf, NULL, 10); - if (enabled == 1) { - has_huge_zeropage = true; - ksft_print_msg("[INFO] huge zeropage is enabled\n"); - } - } - - close(fd); -} - static bool range_is_swapped(void *addr, size_t size) { for (; size; addr += pagesize, size -= pagesize) @@ -1903,7 +1878,7 @@ int main(int argc, char **argv) } nr_hugetlbsizes = detect_hugetlb_page_sizes(hugetlbsizes, ARRAY_SIZE(hugetlbsizes)); - detect_huge_zeropage(); + has_huge_zeropage = detect_huge_zeropage(); ksft_set_plan(ARRAY_SIZE(anon_test_cases) * tests_per_anon_test_case() + ARRAY_SIZE(anon_thp_test_cases) * tests_per_anon_thp_test_case() + |
