linux/tools/testing/selftests/cgroup
Joshua Hahn 8c7fdc0b4c selftests/cgroup: account for zswap shrinker writeback
The test_no_invasive_cgroup_shrink selftest checks that when a cgroup has
zswapped out more memory than memory.zswap.max, it does not trigger
writeback for other cgroups.  To do this, it compares the writeback count
in a control cgroup and makes sure that it is 0, and then checks the
writeback count in an aggressor cgroup who does expect to see writeback.

However, when the zswap shrinker is enabled, the victim cgroup can see
legitimate writebacks not triggered by the aggressor.  In some Meta CI
tests, we have seen this failure mode happen.

Instead of checking that the victim cgroup has 0 writeback, compare the
writeback values before and after the aggressor runs and check that the
victim cgroup did not perform any additional writeback.  Note that this
can still lead to probabilistic failures if writebacks take longer than
5 seconds, but this should fix the systematic failure case and make
"not ok test_no_invasive_cgroup_shrink" less likely.

Link: https://lore.kernel.org/20260902194521.3652178-1-joshua.hahnjy@gmail.com
Fixes: b5ba474f3f ("zswap: shrink zswap pool based on memory pressure")
Signed-off-by: Joshua Hahn <joshua.hahnjy@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reported-by: Krush Chavan <krushchavan@outlook.com>
Suggested-by: Nhat Pham <nphamcs@gmail.com>
Cc: <stable@vger.kernel.org>
2026-09-18 08:20:13 -07:00
..
lib mm.git review status for linus..mm-stable 2026-08-27 09:17:06 -07:00
.gitignore selftests: cgroup: Add basic tests for pids controller 2024-05-26 08:45:10 -10:00
config mm: remove CONFIG_MEMCG_KMEM 2024-07-10 12:14:54 -07:00
Makefile cgroup: selftests: Move cgroup_util into its own library 2025-05-16 11:45:15 -07:00
memcg_protection.m selftests: memcg: adjust expected reclaim values of protected cgroups 2022-05-27 09:33:45 -07:00
test_core.c selftests/cgroup: set the test plan after the setup checks 2026-08-19 10:04:43 -10:00
test_cpu.c selftests/cgroup: set the test plan after the setup checks 2026-08-19 10:04:43 -10:00
test_cpuset_prs.sh selftests/cgroup: Add test for preserving boot-isolated CPUs 2026-08-24 07:01:44 -10:00
test_cpuset_v1_base.sh selftests/cgroup: Fix string comparison in write_test 2026-05-10 15:54:12 -10:00
test_cpuset_v1_hp.sh selftests/cgroup: Avoid awk -e in cpuset tests 2026-08-10 09:28:03 -10:00
test_cpuset.c selftests/cgroup: set the test plan after the setup checks 2026-08-19 10:04:43 -10:00
test_freezer.c selftests/cgroup: set the test plan after the setup checks 2026-08-19 10:04:43 -10:00
test_hugetlb_memcg.c selftests/cgroup: fix missing TAP output in test_hugetlb_memcg 2026-07-14 11:42:10 -10:00
test_kill.c selftests/cgroup: test clone3() into a previously killed cgroup 2026-08-31 06:19:53 -10:00
test_kmem.c selftests/cgroup: Fix cg_run_in_subcgroups ignoring arg parameter 2026-08-20 07:48:01 -10:00
test_memcontrol.c selftests/cgroup: set the test plan after the setup checks 2026-08-19 10:04:43 -10:00
test_pids.c selftests/cgroup: set the test plan after the setup checks 2026-08-19 10:04:43 -10:00
test_stress.sh kseltest/cgroup: Make test_stress.sh work if run interactively 2022-05-13 09:33:21 -10:00
test_zswap.c selftests/cgroup: account for zswap shrinker writeback 2026-09-18 08:20:13 -07:00
wait_inotify.c kselftest/cgroup: Add cpuset v2 partition root state test 2022-09-04 10:47:28 -10:00
with_stress.sh selftests: cgroup: Run test_core under interfering stress 2019-10-07 07:11:54 -07:00