Re: [PATCH v6 8/8] selftests/cgroup: test_zswap: wait for asynchronous writeback

Nhat Pham
2026-04-13T00:01:41Z

On Wed, Apr 1, 2026 at 11:38 PM Li Wang <liwang@redhat.com> wrote:
>
> zswap writeback is asynchronous, but test_zswap.c checks writeback
> counters immediately after reclaim/trigger paths. On some platforms
> (e.g. ppc64le), this can race with background writeback and cause
> spurious failures even when behavior is correct.
>
> Add wait_for_writeback() to poll get_cg_wb_count() with a bounded
> timeout, and use it in:
>
> test_zswap_writeback_one() when writeback is expected
> test_no_invasive_cgroup_shrink() for the wb_group check
>
> This keeps the original before/after assertion style while making the
> tests robust against writeback completion latency.
>
> No test behavior change, selftest stability improvement only.
>
> Signed-off-by: Li Wang <liwang@redhat.com>

LGTM.