cgroup: Add test_cpucg_stats() testcase to cgroup cpu selftests
authorDavid Vernet <void@manifault.com>
Fri, 22 Apr 2022 17:33:51 +0000 (10:33 -0700)
committerTejun Heo <tj@kernel.org>
Fri, 22 Apr 2022 18:39:32 +0000 (08:39 -1000)
commit3c879a1bb88792c05c2dd6a957423838b2830d73
treec08614ef0ac6f46817fe5bc4e66bdf7d2e131b42
parent820a4f88ee4636433a46fcf14054036d0f71e798
cgroup: Add test_cpucg_stats() testcase to cgroup cpu selftests

test_cpu.c includes testcases that validate the cgroup cpu controller.
This patch adds a new testcase called test_cpucg_stats() that verifies the
expected behavior of the cpu.stat interface. In doing so, we define a
new hog_cpus_timed() function which takes a cpu_hog_func_param struct
that configures how many CPUs it uses, and how long it runs. Future
patches will also spawn threads that hog CPUs, so this function will
eventually serve those use-cases as well.

Signed-off-by: David Vernet <void@manifault.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
tools/testing/selftests/cgroup/cgroup_util.h
tools/testing/selftests/cgroup/test_cpu.c