Lines Matching +full:max +full:- +full:retries

1 /* SPDX-License-Identifier: GPL-2.0 */
52 return -1;
76 return -1;
176 int ret = -1;
181 return -1;
210 int ret = -1;
216 return -1;
250 int peak_fd = -1, peak_fd2 = -1, peak_fd3 = -1, peak_fd4 = -1;
276 * We'll open a few FDs for the same memory.peak file to exercise the free-path
278 * the linked-list handling.
282 if (peak_fd == -1) {
303 if (peak_fd2 == -1)
308 if (peak_fd3 == -1)
311 /* any non-empty string resets, but make it clear */
326 /* Make sure a completely independent read isn't affected by our FD-local reset above*/
337 if (peak_fd4 == -1)
394 return -1;
411 return -1;
432 for (limit = 10; limit > 0; limit--) {
438 return -1;
445 * A memory.min = 0, memory.max = 200M
519 if (cg_write(parent[0], "memory.max", "200M"))
522 if (cg_write(parent[0], "memory.swap.max", "0"))
614 int ignore_low_events_index = has_recursiveprot ? 2 : -1;
635 for (i = ARRAY_SIZE(children) - 1; i >= 0; i--) {
643 for (i = ARRAY_SIZE(parent) - 1; i >= 0; i--) {
667 int ret = -1;
668 long current, high, max;
672 max = cg_read_long(cgroup, "memory.max");
673 if (high != MB(30) && max != MB(30))
674 return -1;
678 return -1;
713 if (cg_read_strcmp(memcg, "memory.high", "max\n"))
716 if (cg_write(memcg, "memory.swap.max", "0"))
752 return -1;
765 int ret = KSFT_FAIL, pid, fd = -1;
778 pre_max = cg_read_key_long(memcg, "memory.events", "max ");
782 if (cg_write(memcg, "memory.swap.max", "0"))
788 if (cg_write(memcg, "memory.max", "140M"))
802 post_max = cg_read_key_long(memcg, "memory.events", "max ");
821 * This test checks that memory.max limits the amount of
829 long current, max;
838 if (cg_read_strcmp(memcg, "memory.max", "max\n"))
841 if (cg_write(memcg, "memory.swap.max", "0"))
844 if (cg_write(memcg, "memory.max", "30M"))
858 max = cg_read_key_long(memcg, "memory.events", "max ");
859 if (max <= 0)
889 int retries, err;
893 for (retries = 5; retries > 0; retries--) {
902 to_reclaim = current - goal;
907 else if (err != -EAGAIN)
920 int fd = -1;
921 int retries;
954 * retries).
956 retries = 5;
959 if (retries--) {
992 int ret = -1;
997 return -1;
1019 * This test checks that memory.swap.max limits the amount of
1027 long max, peak;
1029 int swap_peak_fd = -1, mem_peak_fd = -1;
1031 /* any non-empty string resets */
1052 if (swap_peak_fd == -1) {
1073 if (mem_peak_fd == -1)
1082 /* switch the swap and mem fds into local-peak tracking mode*/
1104 if (cg_read_strcmp(memcg, "memory.max", "max\n"))
1107 if (cg_read_strcmp(memcg, "memory.swap.max", "max\n"))
1110 if (cg_write(memcg, "memory.swap.max", "30M"))
1113 if (cg_write(memcg, "memory.max", "30M"))
1144 * multiple extant fds don't corrupt the linked-list
1184 max = cg_read_key_long(memcg, "memory.events", "max ");
1185 if (max <= 0)
1207 if (mem_peak_fd != -1 && close(mem_peak_fd))
1209 if (swap_peak_fd != -1 && close(swap_peak_fd))
1234 if (cg_write(memcg, "memory.max", "30M"))
1237 if (cg_write(memcg, "memory.swap.max", "0"))
1271 int sk, client_sk, ctl_fd, yes = 1, ret = -1;
1273 close(srv_args->ctl[0]);
1274 ctl_fd = srv_args->ctl[1];
1278 saddr.sin6_port = htons(srv_args->port);
1297 ret = -1;
1305 ret = -1;
1328 int retries = 0x10; /* nice round number */
1338 sk = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1342 ret = connect(sk, ai->ai_addr, ai->ai_addrlen);
1347 while (retries--) {
1361 if (values_close(current - allocated, sock, 10)) {
1395 while (bind_retries--) {
1474 if (cg_write(child, "memory.max", "50M"))
1477 if (cg_write(child, "memory.swap.max", "0"))
1542 if (cg_write(parent, "memory.max", "80M"))
1545 if (cg_write(parent, "memory.swap.max", "0"))
1595 if (cg_write(memcg, "memory.max", "50M"))
1598 if (cg_write(memcg, "memory.swap.max", "0"))