On Fri, Apr 24, 2026 at 12:00:52PM +0800, Li Wang <[email protected]> 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 <[email protected]>
> Cc: Johannes Weiner <[email protected]>
> Cc: Michal Hocko <[email protected]>
> Cc: Michal Koutný <[email protected]>
> Cc: Muchun Song <[email protected]>
> Cc: Nhat Pham <[email protected]>
> Cc: Tejun Heo <[email protected]>
> Cc: Roman Gushchin <[email protected]>
> Cc: Shakeel Butt <[email protected]>
> Cc: Yosry Ahmed <[email protected]>
> Acked-by: Yosry Ahmed <[email protected]>
> Acked-by: Nhat Pham <[email protected]>
> ---
>  tools/testing/selftests/cgroup/test_zswap.c | 19 +++++++++++++++----
>  1 file changed, 15 insertions(+), 4 deletions(-)

Reviewed-by: Michal Koutný <[email protected]>

Attachment: signature.asc
Description: PGP signature

Reply via email to