diff options
author | David Vernet <void@manifault.com> | 2022-04-22 20:33:52 +0300 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2022-04-22 21:39:32 +0300 |
commit | 6376b22cd0a3455a534b6921b816ffab68ddc48f (patch) | |
tree | effbe15726c30e72f53f338f1fb36051406fe917 /tools/testing/selftests/cgroup/cgroup_util.c | |
parent | 3c879a1bb88792c05c2dd6a957423838b2830d73 (diff) | |
download | linux-6376b22cd0a3455a534b6921b816ffab68ddc48f.tar.xz |
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')
-rw-r--r-- | tools/testing/selftests/cgroup/cgroup_util.c | 12 |
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]; |