Skip to content

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

Li Wang cgroups linux-kselftest linux-mm lkml 5 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v6 Latest8 patches 5 repliesIn review
  2. v58 patches 6 repliesSuperseded
  3. v47 patches 14 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v37 patches6 repliesSuperseded
v27 patches10 repliesSuperseded

Changes in v6 from the cover letter

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.

Patches in v6 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8selftests/cgroup: skip test_zswap if zswap is globally disabledtools/testing/selftests/cgroup/test_zswap.c+15 -40 replies
2/8selftests/cgroup: avoid OOM in test_swapin_nozswaptools/testing/selftests/cgroup/test_zswap.c+11 -60 replies
3/8selftests/cgroup: use runtime page size for zswpin checktools/testing/selftests/cgroup/test_zswap.c+1 -10 replies
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 -200 replies
5/8selftests/cgroup: replace hardcoded page size values in test_zswaptools/testing/selftests/cgroup/test_zswap.c+24 -191 reply
6/8selftest/cgroup: fix zswap test_no_invasive_cgroup_shrink on large pagesize systemtools/testing/selftests/cgroup/test_zswap.c+49 -212 replies
7/8selftest/cgroup: fix zswap attempt_writeback() on 64K pagesize systemtools/testing/selftests/cgroup/test_zswap.c+4 -41 reply
8/8selftests/cgroup: test_zswap: wait for asynchronous writebacktools/testing/selftests/cgroup/test_zswap.c+26 -21 reply

Reviews trailers per patch

7 of 8 patches have a Reviewed-by or Acked-by.

PatchYosry AhmedNhat Pham
1/8A-b A-b
2/8A-b A-b
3/8R-b A-b
4/8
5/8A-b A-b
6/8A-b
7/8A-b A-b
8/8A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v6 thread

Cover letter [PATCH v6 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 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   | 179 ++++++++++++------
 6 files changed, 151 insertions(+), 73 deletions(-)
Signature · 1 line
2.53.0