Lines Matching full:memory
25 * the memory controller.
33 /* Create two nested cgroups with the memory controller enabled */ in test_memcg_subtree_control()
42 if (cg_write(parent, "cgroup.subtree_control", "+memory")) in test_memcg_subtree_control()
48 if (cg_read_strstr(child, "cgroup.controllers", "memory")) in test_memcg_subtree_control()
51 /* Create two nested cgroups without enabling memory controller */ in test_memcg_subtree_control()
66 if (!cg_read_strstr(child2, "cgroup.controllers", "memory")) in test_memcg_subtree_control()
100 current = cg_read_long(cgroup, "memory.current"); in alloc_anon_50M_check()
107 anon = cg_read_key_long(cgroup, "memory.stat", "anon "); in alloc_anon_50M_check()
134 current = cg_read_long(cgroup, "memory.current"); in alloc_pagecache_50M_check()
138 file = cg_read_key_long(cgroup, "memory.stat", "file "); in alloc_pagecache_50M_check()
153 * This test create a memory cgroup, allocates
154 * some anonymous memory and some pagecache
155 * and check memory.current and some memory.stat values.
170 current = cg_read_long(memcg, "memory.current"); in test_memcg_current()
242 * A memory.min = 50M, memory.max = 200M
243 * A/B memory.min = 50M, memory.current = 50M
244 * A/B/C memory.min = 75M, memory.current = 50M
245 * A/B/D memory.min = 25M, memory.current = 50M
246 * A/B/E memory.min = 500M, memory.current = 0
247 * A/B/F memory.min = 0, memory.current = 50M
252 * memory pressure in it.
254 * A/B memory.current ~= 50M
255 * A/B/C memory.current ~= 33M
256 * A/B/D memory.current ~= 17M
257 * A/B/E memory.current ~= 0
260 * unprotected memory in A available, and checks
261 * checks that memory.min protects pagecache even
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()
309 if (cg_write(parent[1], "cgroup.subtree_control", "+memory")) 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()
344 while (!values_close(cg_read_long(parent[1], "memory.current"), in test_memcg_min()
354 if (!values_close(cg_read_long(parent[1], "memory.current"), MB(50), 3)) in test_memcg_min()
358 c[i] = cg_read_long(children[i], "memory.current"); in test_memcg_min()
372 if (!values_close(cg_read_long(parent[1], "memory.current"), MB(50), 3)) in test_memcg_min()
399 * A memory.low = 50M, memory.max = 200M
400 * A/B memory.low = 50M, memory.current = 50M
401 * A/B/C memory.low = 75M, memory.current = 50M
402 * A/B/D memory.low = 25M, memory.current = 50M
403 * A/B/E memory.low = 500M, memory.current = 0
404 * A/B/F memory.low = 0, memory.current = 50M
408 * memory pressure in it.
410 * Then it checks actual memory usages and expects that:
411 * A/B memory.current ~= 50M
412 * A/B/ memory.current ~= 33M
413 * A/B/D memory.current ~= 17M
414 * A/B/E memory.current ~= 0
417 * unprotected memory in A available,
418 * and checks low and oom events in memory.events.
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()
464 if (cg_write(parent[1], "cgroup.subtree_control", "+memory")) 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()
501 if (!values_close(cg_read_long(parent[1], "memory.current"), MB(50), 3)) in test_memcg_low()
505 c[i] = cg_read_long(children[i], "memory.current"); in test_memcg_low()
518 "memory.low prevents from allocating anon memory\n"); in test_memcg_low()
523 oom = cg_read_key_long(children[i], "memory.events", "oom "); in test_memcg_low()
524 low = cg_read_key_long(children[i], "memory.events", "low "); in test_memcg_low()
570 current = cg_read_long(cgroup, "memory.current"); in alloc_pagecache_max_30M()
583 * This test checks that memory.high limits the amount of
584 * memory which can be consumed by either anonymous memory
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()
618 high = cg_read_key_long(memcg, "memory.events", "high "); in test_memcg_high()
632 * This test checks that memory.max limits the amount of
633 * memory which can be consumed by either anonymous memory
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()
665 current = cg_read_long(memcg, "memory.current"); in test_memcg_max()
669 max = cg_read_key_long(memcg, "memory.events", "max "); in test_memcg_max()
694 mem_current = cg_read_long(cgroup, "memory.current"); in alloc_anon_50M_check_swap()
698 swap_current = cg_read_long(cgroup, "memory.swap.current"); in alloc_anon_50M_check_swap()
710 * This test checks that memory.swap.max limits the amount of
711 * anonymous memory which can be swapped out.
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()
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()
759 max = cg_read_key_long(memcg, "memory.events", "max "); in test_memcg_swap_max()
773 * This test disables swapping and tries to allocate anonymous memory
775 * memory.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()
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()
907 current = cg_read_long(cgroup, "memory.current"); in tcp_client()
908 sock = cg_read_key_long(cgroup, "memory.stat", "sock "); in tcp_client()
930 * This test checks socket memory accounting.
935 * memory.current and memory.stat.sock are similar.
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()
1003 * This test disables swapping and tries to allocate anonymous memory
1004 * up to OOM with memory.group.oom set. Then it checks that all
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()
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()
1065 * This test disables swapping and tries to allocate anonymous memory
1066 * up to OOM with memory.group.oom set. Then it checks that all
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()
1121 * This test disables swapping and tries to allocate anonymous memory
1122 * up to OOM with memory.group.oom set. Then it checks that all
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()
1156 if (cg_read_key_long(memcg, "memory.events", "oom_kill ") != 3) in test_memcg_oom_group_score_events()
1202 * Check that memory controller is available: in main()
1203 * memory is listed in cgroup.controllers in main()
1205 if (cg_read_strstr(root, "cgroup.controllers", "memory")) in main()
1206 ksft_exit_skip("memory controller isn't available\n"); 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()
1210 ksft_exit_skip("Failed to set memory controller\n"); in main()