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

1 /* SPDX-License-Identifier: GPL-2.0 */
29 char *parent, *child, *parent2 = NULL, *child2 = NULL; in test_memcg_subtree_control() local
34 parent = cg_name(root, "memcg_test_0"); in test_memcg_subtree_control()
35 child = cg_name(root, "memcg_test_0/memcg_test_1"); in test_memcg_subtree_control()
36 if (!parent || !child) in test_memcg_subtree_control()
39 if (cg_create(parent)) in test_memcg_subtree_control()
42 if (cg_write(parent, "cgroup.subtree_control", "+memory")) in test_memcg_subtree_control()
45 if (cg_create(child)) in test_memcg_subtree_control()
48 if (cg_read_strstr(child, "cgroup.controllers", "memory")) in test_memcg_subtree_control()
79 cg_destroy(child); in test_memcg_subtree_control()
81 cg_destroy(parent); in test_memcg_subtree_control()
83 free(parent); in test_memcg_subtree_control()
84 free(child); in test_memcg_subtree_control()
94 int ret = -1; in alloc_anon_50M_check()
123 int ret = -1; in alloc_pagecache_50M_check()
129 return -1; in alloc_pagecache_50M_check()
202 return -1; in alloc_pagecache_50M_noexit()
215 return -1; in alloc_anon_noexit()
231 for (limit = 10; limit > 0; limit--) { in cg_test_proc_killed()
237 return -1; in cg_test_proc_killed()
267 char *parent[3] = {NULL}; in test_memcg_min() local
277 parent[0] = cg_name(root, "memcg_test_0"); in test_memcg_min()
278 if (!parent[0]) in test_memcg_min()
281 parent[1] = cg_name(parent[0], "memcg_test_1"); in test_memcg_min()
282 if (!parent[1]) in test_memcg_min()
285 parent[2] = cg_name(parent[0], "memcg_test_2"); in test_memcg_min()
286 if (!parent[2]) in test_memcg_min()
289 if (cg_create(parent[0])) in test_memcg_min()
292 if (cg_read_long(parent[0], "memory.min")) { in test_memcg_min()
297 if (cg_write(parent[0], "cgroup.subtree_control", "+memory")) in test_memcg_min()
300 if (cg_write(parent[0], "memory.max", "200M")) in test_memcg_min()
303 if (cg_write(parent[0], "memory.swap.max", "0")) in test_memcg_min()
306 if (cg_create(parent[1])) in test_memcg_min()
309 if (cg_write(parent[1], "cgroup.subtree_control", "+memory")) in test_memcg_min()
312 if (cg_create(parent[2])) in test_memcg_min()
316 children[i] = cg_name_indexed(parent[1], "child_memcg", i); in test_memcg_min()
330 if (cg_write(parent[0], "memory.min", "50M")) in test_memcg_min()
332 if (cg_write(parent[1], "memory.min", "50M")) in test_memcg_min()
344 while (!values_close(cg_read_long(parent[1], "memory.current"), in test_memcg_min()
351 if (cg_run(parent[2], alloc_anon, (void *)MB(148))) in test_memcg_min()
354 if (!values_close(cg_read_long(parent[1], "memory.current"), MB(50), 3)) in test_memcg_min()
369 if (!cg_run(parent[2], alloc_anon, (void *)MB(170))) in test_memcg_min()
372 if (!values_close(cg_read_long(parent[1], "memory.current"), MB(50), 3)) in test_memcg_min()
378 for (i = ARRAY_SIZE(children) - 1; i >= 0; i--) { in test_memcg_min()
386 for (i = ARRAY_SIZE(parent) - 1; i >= 0; i--) { in test_memcg_min()
387 if (!parent[i]) in test_memcg_min()
390 cg_destroy(parent[i]); in test_memcg_min()
391 free(parent[i]); in test_memcg_min()
423 char *parent[3] = {NULL}; in test_memcg_low() local
434 parent[0] = cg_name(root, "memcg_test_0"); in test_memcg_low()
435 if (!parent[0]) in test_memcg_low()
438 parent[1] = cg_name(parent[0], "memcg_test_1"); in test_memcg_low()
439 if (!parent[1]) in test_memcg_low()
442 parent[2] = cg_name(parent[0], "memcg_test_2"); in test_memcg_low()
443 if (!parent[2]) in test_memcg_low()
446 if (cg_create(parent[0])) in test_memcg_low()
449 if (cg_read_long(parent[0], "memory.low")) in test_memcg_low()
452 if (cg_write(parent[0], "cgroup.subtree_control", "+memory")) in test_memcg_low()
455 if (cg_write(parent[0], "memory.max", "200M")) in test_memcg_low()
458 if (cg_write(parent[0], "memory.swap.max", "0")) in test_memcg_low()
461 if (cg_create(parent[1])) in test_memcg_low()
464 if (cg_write(parent[1], "cgroup.subtree_control", "+memory")) in test_memcg_low()
467 if (cg_create(parent[2])) in test_memcg_low()
471 children[i] = cg_name_indexed(parent[1], "child_memcg", i); in test_memcg_low()
485 if (cg_write(parent[0], "memory.low", "50M")) in test_memcg_low()
487 if (cg_write(parent[1], "memory.low", "50M")) in test_memcg_low()
498 if (cg_run(parent[2], alloc_anon, (void *)MB(148))) in test_memcg_low()
501 if (!values_close(cg_read_long(parent[1], "memory.current"), MB(50), 3)) in test_memcg_low()
516 if (cg_run(parent[2], alloc_anon, (void *)MB(166))) { in test_memcg_low()
537 for (i = ARRAY_SIZE(children) - 1; i >= 0; i--) { in test_memcg_low()
545 for (i = ARRAY_SIZE(parent) - 1; i >= 0; i--) { in test_memcg_low()
546 if (!parent[i]) in test_memcg_low()
549 cg_destroy(parent[i]); in test_memcg_low()
550 free(parent[i]); in test_memcg_low()
559 int ret = -1; in alloc_pagecache_max_30M()
565 return -1; in alloc_pagecache_max_30M()
688 int ret = -1; in alloc_anon_50M_check_swap()
826 int sk, client_sk, ctl_fd, yes = 1, ret = -1; in tcp_server()
828 close(srv_args->ctl[0]); in tcp_server()
829 ctl_fd = srv_args->ctl[1]; in tcp_server()
833 saddr.sin6_port = htons(srv_args->port); in tcp_server()
852 ret = -1; in tcp_server()
860 ret = -1; in tcp_server()
891 sk = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); in tcp_client()
895 ret = connect(sk, ai->ai_addr, ai->ai_addrlen); in tcp_client()
900 while (retries--) { in tcp_client()
950 while (bind_retries--) { in test_memcg_sock()
1005 * processes in the leaf (but not the parent) were killed.
1010 char *parent, *child; in test_memcg_oom_group_leaf_events() local
1012 parent = cg_name(root, "memcg_test_0"); in test_memcg_oom_group_leaf_events()
1013 child = cg_name(root, "memcg_test_0/memcg_test_1"); in test_memcg_oom_group_leaf_events()
1015 if (!parent || !child) in test_memcg_oom_group_leaf_events()
1018 if (cg_create(parent)) in test_memcg_oom_group_leaf_events()
1021 if (cg_create(child)) in test_memcg_oom_group_leaf_events()
1024 if (cg_write(parent, "cgroup.subtree_control", "+memory")) in test_memcg_oom_group_leaf_events()
1027 if (cg_write(child, "memory.max", "50M")) in test_memcg_oom_group_leaf_events()
1030 if (cg_write(child, "memory.swap.max", "0")) in test_memcg_oom_group_leaf_events()
1033 if (cg_write(child, "memory.oom.group", "1")) in test_memcg_oom_group_leaf_events()
1036 cg_run_nowait(parent, alloc_anon_noexit, (void *) MB(60)); in test_memcg_oom_group_leaf_events()
1037 cg_run_nowait(child, alloc_anon_noexit, (void *) MB(1)); in test_memcg_oom_group_leaf_events()
1038 cg_run_nowait(child, alloc_anon_noexit, (void *) MB(1)); in test_memcg_oom_group_leaf_events()
1039 if (!cg_run(child, alloc_anon, (void *)MB(100))) in test_memcg_oom_group_leaf_events()
1042 if (cg_test_proc_killed(child)) in test_memcg_oom_group_leaf_events()
1045 if (cg_read_key_long(child, "memory.events", "oom_kill ") <= 0) in test_memcg_oom_group_leaf_events()
1048 if (cg_read_key_long(parent, "memory.events", "oom_kill ") != 0) in test_memcg_oom_group_leaf_events()
1054 if (child) in test_memcg_oom_group_leaf_events()
1055 cg_destroy(child); in test_memcg_oom_group_leaf_events()
1056 if (parent) in test_memcg_oom_group_leaf_events()
1057 cg_destroy(parent); in test_memcg_oom_group_leaf_events()
1058 free(child); in test_memcg_oom_group_leaf_events()
1059 free(parent); in test_memcg_oom_group_leaf_events()
1067 * processes in the parent and leaf were killed.
1072 char *parent, *child; in test_memcg_oom_group_parent_events() local
1074 parent = cg_name(root, "memcg_test_0"); in test_memcg_oom_group_parent_events()
1075 child = cg_name(root, "memcg_test_0/memcg_test_1"); in test_memcg_oom_group_parent_events()
1077 if (!parent || !child) in test_memcg_oom_group_parent_events()
1080 if (cg_create(parent)) in test_memcg_oom_group_parent_events()
1083 if (cg_create(child)) in test_memcg_oom_group_parent_events()
1086 if (cg_write(parent, "memory.max", "80M")) in test_memcg_oom_group_parent_events()
1089 if (cg_write(parent, "memory.swap.max", "0")) in test_memcg_oom_group_parent_events()
1092 if (cg_write(parent, "memory.oom.group", "1")) in test_memcg_oom_group_parent_events()
1095 cg_run_nowait(parent, alloc_anon_noexit, (void *) MB(60)); in test_memcg_oom_group_parent_events()
1096 cg_run_nowait(child, alloc_anon_noexit, (void *) MB(1)); in test_memcg_oom_group_parent_events()
1097 cg_run_nowait(child, alloc_anon_noexit, (void *) MB(1)); in test_memcg_oom_group_parent_events()
1099 if (!cg_run(child, alloc_anon, (void *)MB(100))) in test_memcg_oom_group_parent_events()
1102 if (cg_test_proc_killed(child)) in test_memcg_oom_group_parent_events()
1104 if (cg_test_proc_killed(parent)) in test_memcg_oom_group_parent_events()
1110 if (child) in test_memcg_oom_group_parent_events()
1111 cg_destroy(child); in test_memcg_oom_group_parent_events()
1112 if (parent) in test_memcg_oom_group_parent_events()
1113 cg_destroy(parent); in test_memcg_oom_group_parent_events()
1114 free(child); in test_memcg_oom_group_parent_events()
1115 free(parent); in test_memcg_oom_group_parent_events()