Lines Matching +full:parent +full:- +full:child
1 /* SPDX-License-Identifier: GPL-2.0 */
33 char *parent, *child, *parent2 = NULL, *child2 = NULL; in test_memcg_subtree_control() local
38 parent = cg_name(root, "memcg_test_0"); in test_memcg_subtree_control()
39 child = cg_name(root, "memcg_test_0/memcg_test_1"); in test_memcg_subtree_control()
40 if (!parent || !child) in test_memcg_subtree_control()
43 if (cg_create(parent)) in test_memcg_subtree_control()
46 if (cg_write(parent, "cgroup.subtree_control", "+memory")) in test_memcg_subtree_control()
49 if (cg_create(child)) in test_memcg_subtree_control()
52 if (cg_read_strstr(child, "cgroup.controllers", "memory")) in test_memcg_subtree_control()
83 cg_destroy(child); in test_memcg_subtree_control()
85 cg_destroy(parent); in test_memcg_subtree_control()
87 free(parent); in test_memcg_subtree_control()
88 free(child); in test_memcg_subtree_control()
98 int ret = -1; in alloc_anon_50M_check()
127 int ret = -1; in alloc_pagecache_50M_check()
133 return -1; in alloc_pagecache_50M_check()
199 return -1; in alloc_pagecache_50M_noexit()
232 for (limit = 10; limit > 0; limit--) { in cg_test_proc_killed()
238 return -1; in cg_test_proc_killed()
273 char *parent[3] = {NULL}; in test_memcg_protection() local
284 parent[0] = cg_name(root, "memcg_test_0"); in test_memcg_protection()
285 if (!parent[0]) in test_memcg_protection()
288 parent[1] = cg_name(parent[0], "memcg_test_1"); in test_memcg_protection()
289 if (!parent[1]) in test_memcg_protection()
292 parent[2] = cg_name(parent[0], "memcg_test_2"); in test_memcg_protection()
293 if (!parent[2]) in test_memcg_protection()
296 if (cg_create(parent[0])) in test_memcg_protection()
299 if (cg_read_long(parent[0], attribute)) { in test_memcg_protection()
306 if (cg_write(parent[0], "cgroup.subtree_control", "+memory")) in test_memcg_protection()
309 if (cg_write(parent[0], "memory.max", "200M")) in test_memcg_protection()
312 if (cg_write(parent[0], "memory.swap.max", "0")) in test_memcg_protection()
315 if (cg_create(parent[1])) in test_memcg_protection()
318 if (cg_write(parent[1], "cgroup.subtree_control", "+memory")) in test_memcg_protection()
321 if (cg_create(parent[2])) in test_memcg_protection()
325 children[i] = cg_name_indexed(parent[1], "child_memcg", i); in test_memcg_protection()
339 if (cg_write(parent[1], attribute, "50M")) in test_memcg_protection()
351 while (!values_close(cg_read_long(parent[1], "memory.current"), in test_memcg_protection()
358 if (cg_run(parent[2], alloc_anon, (void *)MB(148))) in test_memcg_protection()
361 if (!values_close(cg_read_long(parent[1], "memory.current"), MB(50), 3)) in test_memcg_protection()
376 rc = cg_run(parent[2], alloc_anon, (void *)MB(170)); in test_memcg_protection()
385 if (!values_close(cg_read_long(parent[1], "memory.current"), MB(50), 3)) in test_memcg_protection()
412 for (i = ARRAY_SIZE(children) - 1; i >= 0; i--) { in test_memcg_protection()
420 for (i = ARRAY_SIZE(parent) - 1; i >= 0; i--) { in test_memcg_protection()
421 if (!parent[i]) in test_memcg_protection()
424 cg_destroy(parent[i]); in test_memcg_protection()
425 free(parent[i]); in test_memcg_protection()
444 int ret = -1; in alloc_pagecache_max_30M()
451 return -1; in alloc_pagecache_max_30M()
455 return -1; in alloc_pagecache_max_30M()
529 return -1; in alloc_anon_mlock()
542 int ret = KSFT_FAIL, pid, fd = -1; in test_memcg_high_sync()
693 if (retries--) { in test_memcg_reclaim()
713 to_reclaim = current - MB(30); in test_memcg_reclaim()
737 if (err == -EAGAIN && retries--) in test_memcg_reclaim()
759 int ret = -1; in alloc_anon_50M_check_swap()
897 int sk, client_sk, ctl_fd, yes = 1, ret = -1; in tcp_server()
899 close(srv_args->ctl[0]); in tcp_server()
900 ctl_fd = srv_args->ctl[1]; in tcp_server()
904 saddr.sin6_port = htons(srv_args->port); in tcp_server()
923 ret = -1; in tcp_server()
931 ret = -1; in tcp_server()
962 sk = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); in tcp_client()
966 ret = connect(sk, ai->ai_addr, ai->ai_addrlen); in tcp_client()
971 while (retries--) { in tcp_client()
1018 while (bind_retries--) { in test_memcg_sock()
1074 * were propagated to the parent level.
1079 char *parent, *child; in test_memcg_oom_group_leaf_events() local
1082 parent = cg_name(root, "memcg_test_0"); in test_memcg_oom_group_leaf_events()
1083 child = cg_name(root, "memcg_test_0/memcg_test_1"); in test_memcg_oom_group_leaf_events()
1085 if (!parent || !child) in test_memcg_oom_group_leaf_events()
1088 if (cg_create(parent)) in test_memcg_oom_group_leaf_events()
1091 if (cg_create(child)) in test_memcg_oom_group_leaf_events()
1094 if (cg_write(parent, "cgroup.subtree_control", "+memory")) in test_memcg_oom_group_leaf_events()
1097 if (cg_write(child, "memory.max", "50M")) in test_memcg_oom_group_leaf_events()
1100 if (cg_write(child, "memory.swap.max", "0")) in test_memcg_oom_group_leaf_events()
1103 if (cg_write(child, "memory.oom.group", "1")) in test_memcg_oom_group_leaf_events()
1106 cg_run_nowait(parent, alloc_anon_noexit, (void *) MB(60)); in test_memcg_oom_group_leaf_events()
1107 cg_run_nowait(child, alloc_anon_noexit, (void *) MB(1)); in test_memcg_oom_group_leaf_events()
1108 cg_run_nowait(child, alloc_anon_noexit, (void *) MB(1)); in test_memcg_oom_group_leaf_events()
1109 if (!cg_run(child, alloc_anon, (void *)MB(100))) in test_memcg_oom_group_leaf_events()
1112 if (cg_test_proc_killed(child)) in test_memcg_oom_group_leaf_events()
1115 if (cg_read_key_long(child, "memory.events", "oom_kill ") <= 0) in test_memcg_oom_group_leaf_events()
1119 parent, "memory.events", "oom_kill "); in test_memcg_oom_group_leaf_events()
1121 * If memory_localevents is not enabled (the default), the parent should in test_memcg_oom_group_leaf_events()
1133 if (child) in test_memcg_oom_group_leaf_events()
1134 cg_destroy(child); in test_memcg_oom_group_leaf_events()
1135 if (parent) in test_memcg_oom_group_leaf_events()
1136 cg_destroy(parent); in test_memcg_oom_group_leaf_events()
1137 free(child); in test_memcg_oom_group_leaf_events()
1138 free(parent); in test_memcg_oom_group_leaf_events()
1146 * processes in the parent and leaf were killed.
1151 char *parent, *child; in test_memcg_oom_group_parent_events() local
1153 parent = cg_name(root, "memcg_test_0"); in test_memcg_oom_group_parent_events()
1154 child = cg_name(root, "memcg_test_0/memcg_test_1"); in test_memcg_oom_group_parent_events()
1156 if (!parent || !child) in test_memcg_oom_group_parent_events()
1159 if (cg_create(parent)) in test_memcg_oom_group_parent_events()
1162 if (cg_create(child)) in test_memcg_oom_group_parent_events()
1165 if (cg_write(parent, "memory.max", "80M")) in test_memcg_oom_group_parent_events()
1168 if (cg_write(parent, "memory.swap.max", "0")) in test_memcg_oom_group_parent_events()
1171 if (cg_write(parent, "memory.oom.group", "1")) in test_memcg_oom_group_parent_events()
1174 cg_run_nowait(parent, alloc_anon_noexit, (void *) MB(60)); in test_memcg_oom_group_parent_events()
1175 cg_run_nowait(child, alloc_anon_noexit, (void *) MB(1)); in test_memcg_oom_group_parent_events()
1176 cg_run_nowait(child, alloc_anon_noexit, (void *) MB(1)); in test_memcg_oom_group_parent_events()
1178 if (!cg_run(child, alloc_anon, (void *)MB(100))) in test_memcg_oom_group_parent_events()
1181 if (cg_test_proc_killed(child)) in test_memcg_oom_group_parent_events()
1183 if (cg_test_proc_killed(parent)) in test_memcg_oom_group_parent_events()
1189 if (child) in test_memcg_oom_group_parent_events()
1190 cg_destroy(child); in test_memcg_oom_group_parent_events()
1191 if (parent) in test_memcg_oom_group_parent_events()
1192 cg_destroy(parent); in test_memcg_oom_group_parent_events()
1193 free(child); in test_memcg_oom_group_parent_events()
1194 free(parent); in test_memcg_oom_group_parent_events()