[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20240222043132.616320-1-nphamcs@gmail.com>
Date: Wed, 21 Feb 2024 20:31:32 -0800
From: Nhat Pham <nphamcs@...il.com>
To: akpm@...ux-foundation.org
Cc: riel@...riel.com,
shuah@...nel.org,
hannes@...xchg.org,
yosryahmed@...gle.com,
tj@...nel.org,
lizefan.x@...edance.com,
roman.gushchin@...ux.dev,
linux-mm@...ck.org,
kernel-team@...a.com,
linux-kernel@...r.kernel.org,
cgroups@...r.kernel.org,
linux-kselftest@...r.kernel.org
Subject: [PATCH v3 3/3] selftests: add zswapin and no zswap tests (fix)
Remove redundant "set up" comment and add check to ensure enough data is
swapped out (in swapin test) and zswapped-in.
Suggested-by: Yosry Ahmed <yosryahmed@...gle.com>
Signed-off-by: Nhat Pham <nphamcs@...il.com>
---
tools/testing/selftests/cgroup/test_zswap.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/tools/testing/selftests/cgroup/test_zswap.c b/tools/testing/selftests/cgroup/test_zswap.c
index c263610a4a60..f0e488ed90d8 100644
--- a/tools/testing/selftests/cgroup/test_zswap.c
+++ b/tools/testing/selftests/cgroup/test_zswap.c
@@ -71,7 +71,7 @@ static int allocate_and_read_bytes(const char *cgroup, void *arg)
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 char *root)
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_shrink(const char *root)
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;
base-commit: 9d193b36872d153e02e80c26203de4ee15127b58
--
2.40.1
Powered by blists - more mailing lists