Re: [PATCH v2] selftests/cgroup: add user_usec sanity check in test_cpucg_nice

Michal Koutný <[email protected]> Fri, 31 Jul 2026 11:18:37 +0200
Newsgroups org.kernel.vger.cgroups,org.kernel.vger.linux-kernel,org.kernel.vger.linux-kselftest
Message-ID <[email protected]>
--tnxx3t7cpk6cygju
Content-Type: text/plain; protected-headers=v1; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Subject: Re: [PATCH v2] selftests/cgroup: add user_usec sanity check in
 test_cpucg_nice
MIME-Version: 1.0

On Thu, Jul 30, 2026 at 09:07:17PM +0800, Shaojie Sun <[email protected]=
n> 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.
>=20
> Signed-off-by: Shaojie Sun <[email protected]>
> ---
> v2: Instead of simply removing the unused user_usec read, add a sanity
>     check (if user_usec <=3D 0, goto cleanup) analogous to test_cpucg_sta=
ts(),
>     as suggested by Michal.
>=20
>  tools/testing/selftests/cgroup/test_cpu.c | 2 ++
>  1 file changed, 2 insertions(+)

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

--tnxx3t7cpk6cygju
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iJEEABYKADkWIQRCE24Fn/AcRjnLivR+PQLnlNv4CAUCamxoaRsUgAAAAAAEAA5t
YW51MiwyLjUrMS4xMiwyLDIACgkQfj0C55Tb+AjaEAD9GI3/HmQMFyz4zdT8cIiB
p9Vql087AqIUXZiczHDlf1YA/3ZACeKyH+gzAyxyuHI8vnYFSBQVd7zAUYO9Mjt5
NToL
=l2Dw
-----END PGP SIGNATURE-----

--tnxx3t7cpk6cygju--