Re: [PATCH v7 1/8] selftests/cgroup: skip test_zswap if zswap is globally disabled

From: Michal Koutný

Date: Wed Jun 17 2026 - 08:34:08 EST


On Fri, Apr 24, 2026 at 12:00:52PM +0800, Li Wang <li.wang@xxxxxxxxx> 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 <li.wang@xxxxxxxxx>
> Cc: Johannes Weiner <hannes@xxxxxxxxxxx>
> Cc: Michal Hocko <mhocko@xxxxxxxxxx>
> Cc: Michal Koutný <mkoutny@xxxxxxxx>
> Cc: Muchun Song <muchun.song@xxxxxxxxx>
> Cc: Nhat Pham <nphamcs@xxxxxxxxx>
> Cc: Tejun Heo <tj@xxxxxxxxxx>
> Cc: Roman Gushchin <roman.gushchin@xxxxxxxxx>
> Cc: Shakeel Butt <shakeel.butt@xxxxxxxxx>
> Cc: Yosry Ahmed <yosryahmed@xxxxxxxxxx>
> Acked-by: Yosry Ahmed <yosry@xxxxxxxxxx>
> Acked-by: Nhat Pham <nphamcs@xxxxxxxxx>
> ---
> tools/testing/selftests/cgroup/test_zswap.c | 19 +++++++++++++++----
> 1 file changed, 15 insertions(+), 4 deletions(-)

Reviewed-by: Michal Koutný <mkoutny@xxxxxxxx>

Attachment: signature.asc
Description: PGP signature