Lines Matching full:memory
29 * the memory controller.
37 /* Create two nested cgroups with the memory controller enabled */ in test_memcg_subtree_control()
46 if (cg_write(parent, "cgroup.subtree_control", "+memory")) in test_memcg_subtree_control()
52 if (cg_read_strstr(child, "cgroup.controllers", "memory")) in test_memcg_subtree_control()
55 /* Create two nested cgroups without enabling memory controller */ in test_memcg_subtree_control()
70 if (!cg_read_strstr(child2, "cgroup.controllers", "memory")) in test_memcg_subtree_control()
109 current = cg_read_long(cgroup, "memory.current"); in alloc_anon_50M_check()
116 anon = cg_read_key_long(cgroup, "memory.stat", "anon "); in alloc_anon_50M_check()
143 current = cg_read_long(cgroup, "memory.current"); in alloc_pagecache_50M_check()
147 file = cg_read_key_long(cgroup, "memory.stat", "file "); in alloc_pagecache_50M_check()
162 * This test create a memory cgroup, allocates
163 * some anonymous memory and some pagecache
164 * and check memory.current and some memory.stat values.
179 current = cg_read_long(memcg, "memory.current"); in test_memcg_current()
255 * A memory.min = 0, memory.max = 200M
256 * A/B memory.min = 50M
257 * A/B/C memory.min = 75M, memory.current = 50M
258 * A/B/D memory.min = 25M, memory.current = 50M
259 * A/B/E memory.min = 0, memory.current = 50M
260 * A/B/F memory.min = 500M, memory.current = 0
262 * (or memory.low if we test soft protection)
267 * memory pressure in A.
269 * Then it checks actual memory usages and expects that:
270 * A/B memory.current ~= 50M
271 * A/B/C memory.current ~= 29M
272 * A/B/D memory.current ~= 21M
273 * A/B/E memory.current ~= 0
274 * A/B/F memory.current = 0
278 * unprotected memory in A available, and checks that:
279 * a) memory.min protects pagecache even in this case,
280 * b) memory.low allows reclaiming page cache with low events.
282 * Then we try to reclaim from A/B/C using memory.reclaim until its
293 const char *attribute = min ? "memory.min" : "memory.low"; in test_memcg_protection()
319 /* No memory.min on older kernels is fine */ in test_memcg_protection()
325 if (cg_write(parent[0], "cgroup.subtree_control", "+memory")) in test_memcg_protection()
328 if (cg_write(parent[0], "memory.max", "200M")) in test_memcg_protection()
331 if (cg_write(parent[0], "memory.swap.max", "0")) in test_memcg_protection()
337 if (cg_write(parent[1], "cgroup.subtree_control", "+memory")) in test_memcg_protection()
370 while (!values_close(cg_read_long(parent[1], "memory.current"), in test_memcg_protection()
380 if (!values_close(cg_read_long(parent[1], "memory.current"), MB(50), 3)) in test_memcg_protection()
384 c[i] = cg_read_long(children[i], "memory.current"); in test_memcg_protection()
400 "memory.low prevents from allocating anon memory\n"); in test_memcg_protection()
405 if (!values_close(cg_read_long(parent[1], "memory.current"), current, 3)) in test_memcg_protection()
420 oom = cg_read_key_long(children[i], "memory.events", "oom "); in test_memcg_protection()
421 low = cg_read_key_long(children[i], "memory.events", "low "); in test_memcg_protection()
471 high = cg_read_long(cgroup, "memory.high"); in alloc_pagecache_max_30M()
472 max = cg_read_long(cgroup, "memory.max"); in alloc_pagecache_max_30M()
483 current = cg_read_long(cgroup, "memory.current"); in alloc_pagecache_max_30M()
496 * This test checks that memory.high limits the amount of
497 * memory which can be consumed by either anonymous memory
513 if (cg_read_strcmp(memcg, "memory.high", "max\n")) in test_memcg_high()
516 if (cg_write(memcg, "memory.swap.max", "0")) in test_memcg_high()
519 if (cg_write(memcg, "memory.high", "30M")) in test_memcg_high()
531 high = cg_read_key_long(memcg, "memory.events", "high "); in test_memcg_high()
560 * This test checks that memory.high is able to throttle big single shot
577 pre_high = cg_read_key_long(memcg, "memory.events", "high "); in test_memcg_high_sync()
578 pre_max = cg_read_key_long(memcg, "memory.events", "max "); in test_memcg_high_sync()
582 if (cg_write(memcg, "memory.swap.max", "0")) in test_memcg_high_sync()
585 if (cg_write(memcg, "memory.high", "30M")) in test_memcg_high_sync()
588 if (cg_write(memcg, "memory.max", "140M")) in test_memcg_high_sync()
601 post_high = cg_read_key_long(memcg, "memory.events", "high "); in test_memcg_high_sync()
602 post_max = cg_read_key_long(memcg, "memory.events", "max "); in test_memcg_high_sync()
621 * This test checks that memory.max limits the amount of
622 * memory which can be consumed by either anonymous memory
638 if (cg_read_strcmp(memcg, "memory.max", "max\n")) in test_memcg_max()
641 if (cg_write(memcg, "memory.swap.max", "0")) in test_memcg_max()
644 if (cg_write(memcg, "memory.max", "30M")) in test_memcg_max()
654 current = cg_read_long(memcg, "memory.current"); in test_memcg_max()
658 max = cg_read_key_long(memcg, "memory.events", "max "); in test_memcg_max()
673 * memory.reclaim.
678 * This function assumes that writing to memory.reclaim is the only
679 * source of change in memory.current (no concurrent allocations or
682 * This function makes sure memory.reclaim is sane. It will return
683 * false if memory.reclaim's error codes do not make sense, even if
694 current = cg_read_long(memcg, "memory.current"); in reclaim_until()
698 /* Did memory.reclaim return 0 incorrectly? */ in reclaim_until()
704 err = cg_write(memcg, "memory.reclaim", buf); in reclaim_until()
714 * This test checks that memory.reclaim reclaims the given
715 * amount of memory (from both anon and file, if possible).
730 current = cg_read_long(memcg, "memory.current"); in test_memcg_reclaim()
755 while (!values_close(cg_read_long(memcg, "memory.current"), in test_memcg_reclaim()
801 mem_current = cg_read_long(cgroup, "memory.current"); in alloc_anon_50M_check_swap()
805 swap_current = cg_read_long(cgroup, "memory.swap.current"); in alloc_anon_50M_check_swap()
817 * This test checks that memory.swap.max limits the amount of
818 * anonymous memory which can be swapped out.
836 if (cg_read_long(memcg, "memory.swap.current")) { in test_memcg_swap_max()
841 if (cg_read_strcmp(memcg, "memory.max", "max\n")) in test_memcg_swap_max()
844 if (cg_read_strcmp(memcg, "memory.swap.max", "max\n")) in test_memcg_swap_max()
847 if (cg_write(memcg, "memory.swap.max", "30M")) in test_memcg_swap_max()
850 if (cg_write(memcg, "memory.max", "30M")) in test_memcg_swap_max()
857 if (cg_read_key_long(memcg, "memory.events", "oom ") != 1) in test_memcg_swap_max()
860 if (cg_read_key_long(memcg, "memory.events", "oom_kill ") != 1) in test_memcg_swap_max()
866 max = cg_read_key_long(memcg, "memory.events", "max "); in test_memcg_swap_max()
880 * This test disables swapping and tries to allocate anonymous memory
882 * memory.events.
896 if (cg_write(memcg, "memory.max", "30M")) in test_memcg_oom_events()
899 if (cg_write(memcg, "memory.swap.max", "0")) in test_memcg_oom_events()
908 if (cg_read_key_long(memcg, "memory.events", "oom ") != 1) in test_memcg_oom_events()
911 if (cg_read_key_long(memcg, "memory.events", "oom_kill ") != 1) in test_memcg_oom_events()
994 allocated = cg_read_long(cgroup, "memory.current"); in tcp_client()
1016 current = cg_read_long(cgroup, "memory.current"); in tcp_client()
1017 sock = cg_read_key_long(cgroup, "memory.stat", "sock "); in tcp_client()
1022 /* exclude the memory not related to socket connection */ in tcp_client()
1037 * This test checks socket memory accounting.
1042 * memory.current and memory.stat.sock are similar.
1094 if (cg_read_long(memcg, "memory.current") < 0) in test_memcg_sock()
1097 if (cg_read_key_long(memcg, "memory.stat", "sock ")) in test_memcg_sock()
1110 * This test disables swapping and tries to allocate anonymous memory
1111 * up to OOM with memory.group.oom set. Then it checks that all
1133 if (cg_write(parent, "cgroup.subtree_control", "+memory")) in test_memcg_oom_group_leaf_events()
1136 if (cg_write(child, "memory.max", "50M")) in test_memcg_oom_group_leaf_events()
1139 if (cg_write(child, "memory.swap.max", "0")) in test_memcg_oom_group_leaf_events()
1142 if (cg_write(child, "memory.oom.group", "1")) in test_memcg_oom_group_leaf_events()
1154 if (cg_read_key_long(child, "memory.events", "oom_kill ") <= 0) in test_memcg_oom_group_leaf_events()
1158 parent, "memory.events", "oom_kill "); in test_memcg_oom_group_leaf_events()
1183 * This test disables swapping and tries to allocate anonymous memory
1184 * up to OOM with memory.group.oom set. Then it checks that all
1204 if (cg_write(parent, "memory.max", "80M")) in test_memcg_oom_group_parent_events()
1207 if (cg_write(parent, "memory.swap.max", "0")) in test_memcg_oom_group_parent_events()
1210 if (cg_write(parent, "memory.oom.group", "1")) in test_memcg_oom_group_parent_events()
1239 * This test disables swapping and tries to allocate anonymous memory
1240 * up to OOM with memory.group.oom set. Then it checks that all
1257 if (cg_write(memcg, "memory.max", "50M")) in test_memcg_oom_group_score_events()
1260 if (cg_write(memcg, "memory.swap.max", "0")) in test_memcg_oom_group_score_events()
1263 if (cg_write(memcg, "memory.oom.group", "1")) in test_memcg_oom_group_score_events()
1274 if (cg_read_key_long(memcg, "memory.events", "oom_kill ") != 3) in test_memcg_oom_group_score_events()
1321 * Check that memory controller is available: in main()
1322 * memory is listed in cgroup.controllers in main()
1324 if (cg_read_strstr(root, "cgroup.controllers", "memory")) in main()
1325 ksft_exit_skip("memory controller isn't available\n"); in main()
1327 if (cg_read_strstr(root, "cgroup.subtree_control", "memory")) in main()
1328 if (cg_write(root, "cgroup.subtree_control", "+memory")) in main()
1329 ksft_exit_skip("Failed to set memory controller\n"); in main()