Re: [PATCH v2] selftests/cgroup: add user_usec sanity check in test_cpucg_nice
From: Michal Koutný
Date: Fri Jul 31 2026 - 05:24:56 EST
On Thu, Jul 30, 2026 at 09:07:17PM +0800, Shaojie Sun <sunshaojie@xxxxxxxxxx> wrote:
> In test_cpucg_nice, after the child process exits, user_usec is
> read from cpu.stat but the value is not checked. Add a sanity check
> to ensure user_usec > 0, analogous to test_cpucg_stats(), so that
> the test fails early if CPU usage wasn't properly accounted.
>
> Signed-off-by: Shaojie Sun <sunshaojie@xxxxxxxxxx>
> ---
> v2: Instead of simply removing the unused user_usec read, add a sanity
> check (if user_usec <= 0, goto cleanup) analogous to test_cpucg_stats(),
> as suggested by Michal.
>
> tools/testing/selftests/cgroup/test_cpu.c | 2 ++
> 1 file changed, 2 insertions(+)
Reviewed-by: Michal Koutný <mkoutny@xxxxxxxx>
Attachment:
signature.asc
Description: PGP signature