path: root/tools/testing/selftests/cgroup/cgroup_util.c
diff options
authorDavid Vernet <void@manifault.com>2022-04-22 10:33:52 -0700
committerTejun Heo <tj@kernel.org>2022-04-22 08:39:32 -1000
commit6376b22cd0a3455a534b6921b816ffab68ddc48f (patch)
treeeffbe15726c30e72f53f338f1fb36051406fe917 /tools/testing/selftests/cgroup/cgroup_util.c
parentcgroup: Add test_cpucg_stats() testcase to cgroup cpu selftests (diff)
cgroup: Add test_cpucg_weight_overprovisioned() testcase
test_cpu.c includes testcases that validate the cgroup cpu controller. This patch adds a new testcase called test_cpucg_weight_overprovisioned() that verifies the expected behavior of creating multiple processes with different cpu.weight, on a system that is overprovisioned. So as to avoid code duplication, this patch also updates cpu_hog_func_param to take a new hog_clock_type enum which informs how time is counted in hog_cpus_timed() (either process time or wall clock time). Signed-off-by: David Vernet <void@manifault.com> Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'tools/testing/selftests/cgroup/cgroup_util.c')
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/testing/selftests/cgroup/cgroup_util.c b/tools/testing/selftests/cgroup/cgroup_util.c
index dbaa7aabbb4a..4297d580e3f8 100644
--- a/tools/testing/selftests/cgroup/cgroup_util.c
+++ b/tools/testing/selftests/cgroup/cgroup_util.c
@@ -190,6 +190,18 @@ int cg_write(const char *cgroup, const char *control, char *buf)
return -1;
+int cg_write_numeric(const char *cgroup, const char *control, long value)
+ char buf[64];
+ int ret;
+ ret = sprintf(buf, "%lu", value);
+ if (ret < 0)
+ return ret;
+ return cg_write(cgroup, control, buf);
int cg_find_unified_root(char *root, size_t len)
char buf[10 * PAGE_SIZE];