Lines Matching full:if
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()
54 if (!parent2 || !child2) in test_memcg_subtree_control()
57 if (cg_create(parent2)) in test_memcg_subtree_control()
60 if (cg_create(child2)) in test_memcg_subtree_control()
63 if (cg_read(child2, "cgroup.controllers", buf, sizeof(buf))) in test_memcg_subtree_control()
66 if (!cg_read_strstr(child2, "cgroup.controllers", "memory")) in test_memcg_subtree_control()
101 if (current < size) in alloc_anon_50M_check()
104 if (!values_close(size, current, 3)) in alloc_anon_50M_check()
108 if (anon < 0) in alloc_anon_50M_check()
111 if (!values_close(anon, current, 3)) in alloc_anon_50M_check()
128 if (fd < 0) in alloc_pagecache_50M_check()
131 if (alloc_pagecache(fd, size)) in alloc_pagecache_50M_check()
135 if (current < size) in alloc_pagecache_50M_check()
139 if (file < 0) in alloc_pagecache_50M_check()
142 if (!values_close(file, current, 10)) in alloc_pagecache_50M_check()
164 if (!memcg) in test_memcg_current()
167 if (cg_create(memcg)) in test_memcg_current()
171 if (current != 0) in test_memcg_current()
174 if (cg_run(memcg, alloc_anon_50M_check, NULL)) in test_memcg_current()
177 if (cg_run(memcg, alloc_pagecache_50M_check, NULL)) in test_memcg_current()
201 if (alloc_pagecache(fd, MB(50))) in alloc_pagecache_50M_noexit()
214 if (alloc_anon(cgroup, arg)) in alloc_anon_noexit()
225 * If we exceed a timeout, fail.
232 if (cg_read_strcmp(cgroup, "cgroup.procs", "") == 0) in cg_test_proc_killed()
274 if (fd < 0) in test_memcg_min()
278 if (!parent[0]) in test_memcg_min()
282 if (!parent[1]) 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()
317 if (!children[i]) in test_memcg_min()
320 if (cg_create(children[i])) in test_memcg_min()
323 if (i == 2) 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()
334 if (cg_write(children[0], "memory.min", "75M")) in test_memcg_min()
336 if (cg_write(children[1], "memory.min", "25M")) in test_memcg_min()
338 if (cg_write(children[2], "memory.min", "500M")) in test_memcg_min()
340 if (cg_write(children[3], "memory.min", "0")) in test_memcg_min()
346 if (attempts++ > 5) 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()
360 if (!values_close(c[0], MB(33), 10)) in test_memcg_min()
363 if (!values_close(c[1], MB(17), 10)) in test_memcg_min()
366 if (!values_close(c[2], 0, 1)) 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()
379 if (!children[i]) in test_memcg_min()
387 if (!parent[i]) in test_memcg_min()
431 if (fd < 0) in test_memcg_low()
435 if (!parent[0]) in test_memcg_low()
439 if (!parent[1]) 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()
472 if (!children[i]) in test_memcg_low()
475 if (cg_create(children[i])) in test_memcg_low()
478 if (i == 2) in test_memcg_low()
481 if (cg_run(children[i], alloc_pagecache_50M, (void *)(long)fd)) 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()
489 if (cg_write(children[0], "memory.low", "75M")) in test_memcg_low()
491 if (cg_write(children[1], "memory.low", "25M")) in test_memcg_low()
493 if (cg_write(children[2], "memory.low", "500M")) in test_memcg_low()
495 if (cg_write(children[3], "memory.low", "0")) 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()
507 if (!values_close(c[0], MB(33), 10)) in test_memcg_low()
510 if (!values_close(c[1], MB(17), 10)) in test_memcg_low()
513 if (!values_close(c[2], 0, 1)) in test_memcg_low()
516 if (cg_run(parent[2], alloc_anon, (void *)MB(166))) { in test_memcg_low()
526 if (oom) in test_memcg_low()
528 if (i < 2 && low <= 0) in test_memcg_low()
530 if (i >= 2 && low) in test_memcg_low()
538 if (!children[i]) in test_memcg_low()
546 if (!parent[i]) in test_memcg_low()
564 if (fd < 0) in alloc_pagecache_max_30M()
567 if (alloc_pagecache(fd, size)) in alloc_pagecache_max_30M()
571 if (current <= MB(29) || current > MB(30)) in alloc_pagecache_max_30M()
594 if (!memcg) in test_memcg_high()
597 if (cg_create(memcg)) in test_memcg_high()
600 if (cg_read_strcmp(memcg, "memory.high", "max\n")) in test_memcg_high()
603 if (cg_write(memcg, "memory.swap.max", "0")) in test_memcg_high()
606 if (cg_write(memcg, "memory.high", "30M")) in test_memcg_high()
609 if (cg_run(memcg, alloc_anon, (void *)MB(100))) in test_memcg_high()
612 if (!cg_run(memcg, alloc_pagecache_50M_check, NULL)) in test_memcg_high()
615 if (cg_run(memcg, alloc_pagecache_max_30M, NULL)) in test_memcg_high()
619 if (high <= 0) in test_memcg_high()
643 if (!memcg) in test_memcg_max()
646 if (cg_create(memcg)) in test_memcg_max()
649 if (cg_read_strcmp(memcg, "memory.max", "max\n")) in test_memcg_max()
652 if (cg_write(memcg, "memory.swap.max", "0")) in test_memcg_max()
655 if (cg_write(memcg, "memory.max", "30M")) in test_memcg_max()
659 if (!cg_run(memcg, alloc_anon, (void *)MB(100))) in test_memcg_max()
662 if (cg_run(memcg, alloc_pagecache_max_30M, NULL)) in test_memcg_max()
666 if (current > MB(30) || !current) in test_memcg_max()
670 if (max <= 0) in test_memcg_max()
695 if (!mem_current || !values_close(mem_current, mem_max, 3)) in alloc_anon_50M_check_swap()
699 if (!swap_current || in alloc_anon_50M_check_swap()
719 if (!is_swap_enabled()) in test_memcg_swap_max()
723 if (!memcg) in test_memcg_swap_max()
726 if (cg_create(memcg)) in test_memcg_swap_max()
729 if (cg_read_long(memcg, "memory.swap.current")) { in test_memcg_swap_max()
734 if (cg_read_strcmp(memcg, "memory.max", "max\n")) in test_memcg_swap_max()
737 if (cg_read_strcmp(memcg, "memory.swap.max", "max\n")) in test_memcg_swap_max()
740 if (cg_write(memcg, "memory.swap.max", "30M")) in test_memcg_swap_max()
743 if (cg_write(memcg, "memory.max", "30M")) in test_memcg_swap_max()
747 if (!cg_run(memcg, alloc_anon, (void *)MB(100))) in test_memcg_swap_max()
750 if (cg_read_key_long(memcg, "memory.events", "oom ") != 1) in test_memcg_swap_max()
753 if (cg_read_key_long(memcg, "memory.events", "oom_kill ") != 1) in test_memcg_swap_max()
756 if (cg_run(memcg, alloc_anon_50M_check_swap, (void *)MB(30))) in test_memcg_swap_max()
760 if (max <= 0) in test_memcg_swap_max()
783 if (!memcg) in test_memcg_oom_events()
786 if (cg_create(memcg)) in test_memcg_oom_events()
789 if (cg_write(memcg, "memory.max", "30M")) in test_memcg_oom_events()
792 if (cg_write(memcg, "memory.swap.max", "0")) in test_memcg_oom_events()
795 if (!cg_run(memcg, alloc_anon, (void *)MB(100))) in test_memcg_oom_events()
798 if (cg_read_strcmp(memcg, "cgroup.procs", "")) in test_memcg_oom_events()
801 if (cg_read_key_long(memcg, "memory.events", "oom ") != 1) in test_memcg_oom_events()
804 if (cg_read_key_long(memcg, "memory.events", "oom_kill ") != 1) in test_memcg_oom_events()
836 if (sk < 0) in tcp_server()
839 if (setsockopt(sk, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(yes)) < 0) in tcp_server()
842 if (bind(sk, (struct sockaddr *)&saddr, slen)) { in tcp_server()
847 if (listen(sk, 1)) in tcp_server()
851 if (write(ctl_fd, &ret, sizeof(ret)) != sizeof(ret)) { in tcp_server()
857 if (client_sk < 0) in tcp_server()
864 if (write(client_sk, buf, sizeof(buf)) <= 0) { in tcp_server()
865 if (errno == ECONNRESET) in tcp_server()
888 if (ret) in tcp_client()
892 if (sk < 0) in tcp_client()
896 if (ret < 0) in tcp_client()
904 if (read(sk, buf, sizeof(buf)) <= 0) in tcp_client()
910 if (current < 0 || sock < 0) in tcp_client()
913 if (current < sock) in tcp_client()
916 if (values_close(current, sock, 10)) { in tcp_client()
944 if (!memcg) in test_memcg_sock()
947 if (cg_create(memcg)) in test_memcg_sock()
953 if (pipe(args.ctl)) in test_memcg_sock()
959 if (pid < 0) in test_memcg_sock()
963 if (read(args.ctl[0], &err, sizeof(err)) != sizeof(err)) in test_memcg_sock()
967 if (!err) in test_memcg_sock()
969 if (err != EADDRINUSE) in test_memcg_sock()
975 if (err == EADDRINUSE) { in test_memcg_sock()
980 if (tcp_client(memcg, port) != KSFT_PASS) in test_memcg_sock()
984 if (WEXITSTATUS(err)) in test_memcg_sock()
987 if (cg_read_long(memcg, "memory.current") < 0) in test_memcg_sock()
990 if (cg_read_key_long(memcg, "memory.stat", "sock ")) in test_memcg_sock()
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()
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()
1056 if (parent) in test_memcg_oom_group_leaf_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()
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()
1112 if (parent) in test_memcg_oom_group_parent_events()
1133 if (!memcg) in test_memcg_oom_group_score_events()
1136 if (cg_create(memcg)) in test_memcg_oom_group_score_events()
1139 if (cg_write(memcg, "memory.max", "50M")) in test_memcg_oom_group_score_events()
1142 if (cg_write(memcg, "memory.swap.max", "0")) in test_memcg_oom_group_score_events()
1145 if (cg_write(memcg, "memory.oom.group", "1")) in test_memcg_oom_group_score_events()
1149 if (set_oom_adj_score(safe_pid, OOM_SCORE_ADJ_MIN)) in test_memcg_oom_group_score_events()
1153 if (!cg_run(memcg, alloc_anon, (void *)MB(100))) in test_memcg_oom_group_score_events()
1156 if (cg_read_key_long(memcg, "memory.events", "oom_kill ") != 3) in test_memcg_oom_group_score_events()
1159 if (kill(safe_pid, SIGKILL)) in test_memcg_oom_group_score_events()
1165 if (memcg) in test_memcg_oom_group_score_events()
1198 if (cg_find_unified_root(root, sizeof(root))) in main()
1205 if (cg_read_strstr(root, "cgroup.controllers", "memory")) in main()
1208 if (cg_read_strstr(root, "cgroup.subtree_control", "memory")) in main()
1209 if (cg_write(root, "cgroup.subtree_control", "+memory")) in main()