On Fri, Apr 24, 2026 at 12:00:52PM +0800, Li Wang
wrote:
> test_zswap currently only checks whether zswap is present by testing
> /sys/module/zswap. This misses the runtime global state exposed in
> /sys/module/zswap/parameters/enabled.
>
> When zswap is built/loaded but globally disabled, the zswap cgroup
> selftests run in an invalid environment and may fail spuriously.
>
> Check the runtime enabled state before running the tests:
> - skip if zswap is not configured,
> - fail if the enabled knob cannot be read,
> - skip if zswap is globally disabled.
>
> Also print a hint in the skip message on how to enable zswap.
>
> Signed-off-by: Li Wang
> Cc: Johannes Weiner
> Cc: Michal Hocko
> Cc: Michal Koutný
> Cc: Muchun Song
> Cc: Nhat Pham
> Cc: Tejun Heo
> Cc: Roman Gushchin
> Cc: Shakeel Butt
> Cc: Yosry Ahmed
> Acked-by: Yosry Ahmed
> Acked-by: Nhat Pham
> ---
> tools/testing/selftests/cgroup/test_zswap.c | 19 +++++++++++++++----
> 1 file changed, 15 insertions(+), 4 deletions(-)
Reviewed-by: Michal Koutný