The patch titled Subject: selftests: add zswapin and no zswap tests (fix) has been added to the -mm mm-unstable branch. Its filename is selftests-add-zswapin-and-no-zswap-tests-fix.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/selftests-add-zswapin-and-no-zswap-tests-fix.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Nhat Pham <nphamcs@xxxxxxxxx> Subject: selftests: add zswapin and no zswap tests (fix) Date: Wed, 21 Feb 2024 20:31:32 -0800 Remove redundant "set up" comment and add check to ensure enough data is swapped out (in swapin test) and zswapped-in. Link: https://lkml.kernel.org/r/20240222043132.616320-1-nphamcs@xxxxxxxxx Signed-off-by: Nhat Pham <nphamcs@xxxxxxxxx> Suggested-by: Yosry Ahmed <yosryahmed@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- tools/testing/selftests/cgroup/test_zswap.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) --- a/tools/testing/selftests/cgroup/test_zswap.c~selftests-add-zswapin-and-no-zswap-tests-fix +++ a/tools/testing/selftests/cgroup/test_zswap.c @@ -71,7 +71,7 @@ static int allocate_and_read_bytes(const for (int i = 0; i < size; i += 4095) mem[i] = 'a'; - /* go through the allocated memory to (z)swap in and out pages */ + /* Go through the allocated memory to (z)swap in and out pages */ for (int i = 0; i < size; i += 4095) { if (mem[i] != 'a') ret = -1; @@ -184,8 +184,8 @@ static int test_swapin_nozswap(const cha goto out; } - if (swap_peak == 0) { - ksft_print_msg("pages should be swapped out\n"); + if (swap_peak < MB(24)) { + ksft_print_msg("at least 24MB of memory should be swapped out\n"); goto out; } @@ -215,7 +215,6 @@ static int test_zswapin(const char *root char *test_group; long zswpin; - /* Set up */ test_group = cg_name(root, "zswapin_test"); if (!test_group) goto out; @@ -236,8 +235,8 @@ static int test_zswapin(const char *root goto out; } - if (zswpin == 0) { - ksft_print_msg("zswpin should not be 0\n"); + if (zswpin < MB(24) / PAGE_SIZE) { + ksft_print_msg("at least 24MB should be brought back from zswap\n"); goto out; } @@ -260,7 +259,6 @@ static int test_no_invasive_cgroup_shrin size_t control_allocation_size = MB(10); char *control_allocation, *wb_group = NULL, *control_group = NULL; - /* Set up */ wb_group = setup_test_group_1M(root, "per_memcg_wb_test1"); if (!wb_group) return KSFT_FAIL; _ Patches currently in -mm which might be from nphamcs@xxxxxxxxx are mm-cachestat-fix-folio-read-after-free-in-cache-walk.patch selftests-zswap-add-zswap-selftest-file-to-zswap-maintainer-entry.patch selftests-fix-the-zswap-invasive-shrink-test.patch selftests-add-zswapin-and-no-zswap-tests.patch selftests-add-zswapin-and-no-zswap-tests-fix.patch