Lines Matching +full:parent +full:- +full:child

1 // SPDX-License-Identifier: GPL-2.0
40 char *parent = NULL, *child = NULL, *parent2 = NULL, *child2 = NULL; in test_cpucg_subtree_control() local
44 parent = cg_name(root, "cpucg_test_0"); in test_cpucg_subtree_control()
45 if (!parent) in test_cpucg_subtree_control()
48 if (cg_create(parent)) in test_cpucg_subtree_control()
51 if (cg_write(parent, "cgroup.subtree_control", "+cpu")) in test_cpucg_subtree_control()
54 child = cg_name(parent, "cpucg_test_child"); in test_cpucg_subtree_control()
55 if (!child) in test_cpucg_subtree_control()
58 if (cg_create(child)) in test_cpucg_subtree_control()
61 if (cg_read_strstr(child, "cgroup.controllers", "cpu")) in test_cpucg_subtree_control()
85 cg_destroy(child); in test_cpucg_subtree_control()
86 free(child); in test_cpucg_subtree_control()
89 cg_destroy(parent); in test_cpucg_subtree_control()
90 free(parent); in test_cpucg_subtree_control()
114 if (lhs->tv_sec < rhs->tv_sec) in timespec_sub()
117 ret.tv_sec = lhs->tv_sec - rhs->tv_sec; in timespec_sub()
119 if (lhs->tv_nsec < rhs->tv_nsec) { in timespec_sub()
123 ret.tv_sec--; in timespec_sub()
124 ret.tv_nsec = NSEC_PER_SEC - rhs->tv_nsec + lhs->tv_nsec; in timespec_sub()
126 ret.tv_nsec = lhs->tv_nsec - rhs->tv_nsec; in timespec_sub()
135 struct timespec ts_run = param->ts; in hog_cpus_timed()
144 for (i = 0; i < param->nprocs; i++) { in hog_cpus_timed()
159 if (param->clock_type == CPU_HOG_CLOCK_PROCESS) { in hog_cpus_timed()
235 pid_t (*spawn_child)(const struct cpu_hogger *child), in run_cpucg_weight_test() argument
239 char *parent = NULL; in run_cpucg_weight_test() local
242 parent = cg_name(root, "cpucg_test_0"); in run_cpucg_weight_test()
243 if (!parent) in run_cpucg_weight_test()
246 if (cg_create(parent)) in run_cpucg_weight_test()
249 if (cg_write(parent, "cgroup.subtree_control", "+cpu")) in run_cpucg_weight_test()
253 children[i].cgroup = cg_name_indexed(parent, "cpucg_child", i); in run_cpucg_weight_test()
295 cg_destroy(parent); in run_cpucg_weight_test()
296 free(parent); in run_cpucg_weight_test()
301 static pid_t weight_hog_ncpus(const struct cpu_hogger *child, int ncpus) in weight_hog_ncpus() argument
312 return cg_run_nowait(child->cgroup, hog_cpus_timed, (void *)&param); in weight_hog_ncpus()
315 static pid_t weight_hog_all_cpus(const struct cpu_hogger *child) in weight_hog_all_cpus() argument
317 return weight_hog_ncpus(child, get_nprocs()); in weight_hog_all_cpus()
325 for (i = 0; i < num_children - 1; i++) { in overprovision_validate()
331 delta = children[i + 1].usage - children[i].usage; in overprovision_validate()
348 * A separate process is then created for each child cgroup which spawns as
352 * Once all of the children have exited, we verify that each child cgroup
361 static pid_t weight_hog_one_cpu(const struct cpu_hogger *child) in weight_hog_one_cpu() argument
363 return weight_hog_ncpus(child, 1); in weight_hog_one_cpu()
371 for (i = 0; i < num_children - 1; i++) { in underprovision_validate()
388 * A separate process is then created for each child cgroup which spawns a
390 * have at least one core per-thread in the child processes.
392 * Once all of the children have exited, we verify that each child cgroup
410 char *parent = NULL, *child = NULL; in run_cpucg_nested_weight_test() local
425 parent = cg_name(root, "cpucg_test"); in run_cpucg_nested_weight_test()
426 child = cg_name(parent, "cpucg_child"); in run_cpucg_nested_weight_test()
427 if (!parent || !child) in run_cpucg_nested_weight_test()
430 if (cg_create(parent)) in run_cpucg_nested_weight_test()
432 if (cg_write(parent, "cgroup.subtree_control", "+cpu")) in run_cpucg_nested_weight_test()
435 if (cg_create(child)) in run_cpucg_nested_weight_test()
437 if (cg_write(child, "cgroup.subtree_control", "+cpu")) in run_cpucg_nested_weight_test()
439 if (cg_write(child, "cpu.weight", "1000")) in run_cpucg_nested_weight_test()
447 ancestor = parent; in run_cpucg_nested_weight_test()
450 ancestor = child; in run_cpucg_nested_weight_test()
507 child_usage = cg_read_key_long(child, "cpu.stat", "usage_usec"); in run_cpucg_nested_weight_test()
519 cg_destroy(child); in run_cpucg_nested_weight_test()
520 free(child); in run_cpucg_nested_weight_test()
521 cg_destroy(parent); in run_cpucg_nested_weight_test()
522 free(parent); in run_cpucg_nested_weight_test()
621 * This test verifies that a process inside of a nested cgroup whose parent
630 char *parent, *child; in test_cpucg_max_nested() local
632 parent = cg_name(root, "cpucg_parent"); in test_cpucg_max_nested()
633 child = cg_name(parent, "cpucg_child"); in test_cpucg_max_nested()
634 if (!parent || !child) in test_cpucg_max_nested()
637 if (cg_create(parent)) in test_cpucg_max_nested()
640 if (cg_write(parent, "cgroup.subtree_control", "+cpu")) in test_cpucg_max_nested()
643 if (cg_create(child)) in test_cpucg_max_nested()
646 if (cg_write(parent, "cpu.max", "1000")) in test_cpucg_max_nested()
657 if (cg_run(child, hog_cpus_timed, (void *)&param)) in test_cpucg_max_nested()
660 usage_usec = cg_read_key_long(child, "cpu.stat", "usage_usec"); in test_cpucg_max_nested()
661 user_usec = cg_read_key_long(child, "cpu.stat", "user_usec"); in test_cpucg_max_nested()
674 cg_destroy(child); in test_cpucg_max_nested()
675 free(child); in test_cpucg_max_nested()
676 cg_destroy(parent); in test_cpucg_max_nested()
677 free(parent); in test_cpucg_max_nested()