Skip to content

selftests/cgroup: improve zswap tests robustness and support large page sizes

Li Wang cgroups linux-kselftest linux-mm lkml sashiko 1 version Applied

Status from this message: [merged mm-stable] selftests-cgroup-test_zswap-wait-for-asynchronous-writeback.patch removed from -mm tree

Get series with b4
b4 am [email protected]

Versions newest first

  1. v7 Latest8 patches 14 repliesApplied 8/8

Changes in v7 from the cover letter

Replace my work email by [email protected] address. Add Acked-by: Nhat Pham <[email protected]> to series. Rebase to the latest branch (only one tiny conflict resolved).

Patches in v7 All 8 applied

#Subject and filesSizeRepliesApplied
1/8selftests/cgroup: skip test_zswap if zswap is globally disabledtools/testing/selftests/cgroup/test_zswap.c+15 -41 replyApplied
2/8selftests/cgroup: avoid OOM in test_swapin_nozswaptools/testing/selftests/cgroup/test_zswap.c+11 -61 replyApplied
3/8selftests/cgroup: use runtime page size for zswpin checktools/testing/selftests/cgroup/test_zswap.c+1 -11 replyApplied
4/8selftests/cgroup: rename PAGE_SIZE to BUF_SIZE in cgroup_utiltools/testing/selftests/cgroup/lib/cgroup_util.c tools/testing/selftests/cgroup/lib/include/cgroup_util.h tools/testing/selftests/cgroup/test_core.c +2 more+25 -202 repliesApplied
5/8selftests/cgroup: replace hardcoded page size values in test_zswaptools/testing/selftests/cgroup/test_zswap.c+25 -202 repliesApplied
6/8selftest/cgroup: fix zswap test_no_invasive_cgroup_shrink on large pagesize systemtools/testing/selftests/cgroup/test_zswap.c+49 -211 replyApplied
7/8selftest/cgroup: fix zswap attempt_writeback() on 64K pagesize systemtools/testing/selftests/cgroup/test_zswap.c+4 -41 replyApplied
8/8selftests/cgroup: test_zswap: wait for asynchronous writebacktools/testing/selftests/cgroup/test_zswap.c+26 -21 replyApplied

Reviews trailers per patch

All 8 patches have a Reviewed-by or Acked-by.

PatchYosry AhmedNhat PhamJiayuan ChenMichal Koutný
1/8A-b A-b R-b
2/8A-b A-b
3/8R-b A-b R-b
4/8A-b
5/8A-b R-b
6/8A-b
7/8A-b A-b R-b
8/8A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.

Read the v7 thread

Cover letter [PATCH v7 0/8] selftests/cgroup: improve zswap tests robustness and support large page sizes

This patchset aims to fix various spurious failures and improve the overall robustness of the cgroup zswap selftests.

The primary motivation is to make the tests compatible with architectures that use non-4K page sizes (such as 64K on ppc64le and arm64). Currently, the tests rely heavily on hardcoded 4K page sizes and fixed memory limits. On 64K page size systems, these hardcoded values lead to sub-page granularity accesses, incorrect page count calculations, and insufficient memory pressure to trigger zswap writeback, ultimately causing the tests to fail.

Additionally, this series addresses OOM kills occurring in test_swapin_nozswap by dynamically scaling memory limits, and prevents spurious test failures when zswap is built into the kernel but globally disabled.

Changes in v7:
Replace my work email by [email protected] address. Add Acked-by: Nhat Pham <[email protected]> to series. Rebase to the latest branch (only one tiny conflict resolved).

Changes in v6:
Patch 4/8: Use page_size instead of BUF_SIZE
Declear page_size as int but not size_t
Patch 5/8: Use page_size replace the sysconf(_SC_PAGE_SIZE). Patch 7/8: Adjust the code comments.
Patch 8/8: Declear long type for elapsed and count variables.

Changes in v5:
Patch 1/8: Defined PATH_ZSWAP and PATH_ZSWAP_ENABLED macros. Patch 4/8: Merge Waiman's work into this patch (use page_size). Patch 5/8: Change pagesize by the global page_size.
Patch 6/8: Swap data patterns: use getrandom() for wb_group and simple
memset for zw_group to fix the reversed allocation logic.
Patch 7/8: Setting zswap.max to zswap_usage/4 to increase writeback pressure. Patch 8/8: New added. Just add loops for read zswpwb more times.

Test all passed on:
x86_64(4k), aarch64(4K, 64K), ppc64le(64K).

Li Wang (8):
selftests/cgroup: skip test_zswap if zswap is globally disabled selftests/cgroup: avoid OOM in test_swapin_nozswap selftests/cgroup: use runtime page size for zswpin check selftests/cgroup: rename PAGE_SIZE to BUF_SIZE in cgroup_util selftests/cgroup: replace hardcoded page size values in test_zswap selftest/cgroup: fix zswap test_no_invasive_cgroup_shrink on large
pagesize system
selftest/cgroup: fix zswap attempt_writeback() on 64K pagesize system selftests/cgroup: test_zswap: wait for asynchronous writeback

 .../selftests/cgroup/lib/cgroup_util.c        |  18 +-
 .../cgroup/lib/include/cgroup_util.h          |   4 +-
 tools/testing/selftests/cgroup/test_core.c    |   2 +-
 tools/testing/selftests/cgroup/test_freezer.c |   2 +-
 .../selftests/cgroup/test_memcontrol.c        |  19 +-
 tools/testing/selftests/cgroup/test_zswap.c   | 181 ++++++++++++------
 6 files changed, 152 insertions(+), 74 deletions(-)
Signature · 1 line
2.53.0