Re: [PATCH v4 3/3] selftests: cgroup: Replace sleep with cg_read_key_long_poll() for waiting on nr_dying_descendants
From: Shakeel Butt
Date: Tue Dec 02 2025 - 18:19:02 EST
On Mon, Nov 24, 2025 at 08:38:16PM +0800, Guopeng Zhang wrote:
> Replaced the manual sleep and retry logic in test_kmem_dead_cgroups() with the new
> helper `cg_read_key_long_poll()`. This change improves the robustness of the test by
> polling the "nr_dying_descendants" counter in `cgroup.stat` until it reaches 0 or the timeout is exceeded.
>
> Additionally, increased the retry timeout to 8 seconds (from 5 seconds) based on testing results:
Why 8 seconds? What does it depend on? For memcg stats I see the 3
seconds driven from the 2 sec periodic rstat flush. Mainly how can we
make this more future proof?
> - With 5-second timeout: 4/20 runs passed.
> - With 8-second timeout: 20/20 runs passed.
>
> Signed-off-by: Guopeng Zhang <zhangguopeng@xxxxxxxxxx>
Anyways, just add a sentence in the commit message on the reasoning
behind 8 seconds and a comment in code as well. With that, you can add:
Reviewed-by: Shakeel Butt <shakeel.butt@xxxxxxxxx>