Re: [PATCH 1/2] selftests/cgroup: remove unused user_usec read in test_cpucg_nice

From: Michal Koutný

Date: Wed Jul 29 2026 - 08:07:56 EST


On Wed, Jul 29, 2026 at 06:04:50PM +0800, Shaojie Sun <sunshaojie@xxxxxxxxxx> wrote:
> diff --git a/tools/testing/selftests/cgroup/test_cpu.c b/tools/testing/selftests/cgroup/test_cpu.c
> index 7a40d76b9548..fe637e1d2fcd 100644
> --- a/tools/testing/selftests/cgroup/test_cpu.c
> +++ b/tools/testing/selftests/cgroup/test_cpu.c
> @@ -289,7 +289,6 @@ static int test_cpucg_nice(const char *root)
> if (!WIFEXITED(status))
> goto cleanup;
>
> - user_usec = cg_read_key_long(cpucg, "cpu.stat", "user_usec");
> nice_usec = cg_read_key_long(cpucg, "cpu.stat", "nice_usec");

Good catch.

This test is anologous to test_cpucg_stats(), so the checks should be
analogous too, like:

user_usec = cg_read_key_long(cpucg, "cpu.stat", "user_usec");
nice_usec = cg_read_key_long(cpucg, "cpu.stat", "nice_usec");
if (user_usec <= 0)
goto cleanup;

instead of the removal.

Thanks,
Michal

Attachment: signature.asc
Description: PGP signature