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()
104 current = cg_read_long(cgroup, "memory.current"); in alloc_anon_50M_check()
111 anon = cg_read_key_long(cgroup, "memory.stat", "anon "); in alloc_anon_50M_check()
138 current = cg_read_long(cgroup, "memory.current"); in alloc_pagecache_50M_check()
142 file = cg_read_key_long(cgroup, "memory.stat", "file "); in alloc_pagecache_50M_check()
157 * This test create a memory cgroup, allocates
158 * some anonymous memory and some pagecache
159 * and check memory.current and some memory.stat values.
174 current = cg_read_long(memcg, "memory.current"); in test_memcg_current()
243 * A memory.min = 0, memory.max = 200M
244 * A/B memory.min = 50M
245 * A/B/C memory.min = 75M, memory.current = 50M
246 * A/B/D memory.min = 25M, memory.current = 50M
247 * A/B/E memory.min = 0, memory.current = 50M
248 * A/B/F memory.min = 500M, memory.current = 0
250 * (or memory.low if we test soft protection)
255 * memory pressure in A.
257 * Then it checks actual memory usages and expects that:
258 * A/B memory.current ~= 50M
259 * A/B/C memory.current ~= 29M
260 * A/B/D memory.current ~= 21M
261 * A/B/E memory.current ~= 0
262 * A/B/F memory.current = 0
266 * unprotected memory in A available, and checks that:
267 * a) memory.min protects pagecache even in this case,
268 * b) memory.low allows reclaiming page cache with low events.
275 const char *attribute = min ? "memory.min" : "memory.low"; in test_memcg_protection()
300 /* No memory.min on older kernels is fine */ 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()
318 if (cg_write(parent[1], "cgroup.subtree_control", "+memory")) in test_memcg_protection()
351 while (!values_close(cg_read_long(parent[1], "memory.current"), in test_memcg_protection()
361 if (!values_close(cg_read_long(parent[1], "memory.current"), MB(50), 3)) in test_memcg_protection()
365 c[i] = cg_read_long(children[i], "memory.current"); in test_memcg_protection()
381 "memory.low prevents from allocating anon memory\n"); in test_memcg_protection()
385 if (!values_close(cg_read_long(parent[1], "memory.current"), MB(50), 3)) in test_memcg_protection()
397 oom = cg_read_key_long(children[i], "memory.events", "oom "); in test_memcg_protection()
398 low = cg_read_key_long(children[i], "memory.events", "low "); in test_memcg_protection()
448 high = cg_read_long(cgroup, "memory.high"); in alloc_pagecache_max_30M()
449 max = cg_read_long(cgroup, "memory.max"); in alloc_pagecache_max_30M()
460 current = cg_read_long(cgroup, "memory.current"); in alloc_pagecache_max_30M()
473 * This test checks that memory.high limits the amount of
474 * memory which can be consumed by either anonymous memory
490 if (cg_read_strcmp(memcg, "memory.high", "max\n")) in test_memcg_high()
493 if (cg_write(memcg, "memory.swap.max", "0")) in test_memcg_high()
496 if (cg_write(memcg, "memory.high", "30M")) in test_memcg_high()
508 high = cg_read_key_long(memcg, "memory.events", "high "); in test_memcg_high()
537 * This test checks that memory.high is able to throttle big single shot
554 pre_high = cg_read_key_long(memcg, "memory.events", "high "); in test_memcg_high_sync()
555 pre_max = cg_read_key_long(memcg, "memory.events", "max "); in test_memcg_high_sync()
559 if (cg_write(memcg, "memory.swap.max", "0")) in test_memcg_high_sync()
562 if (cg_write(memcg, "memory.high", "30M")) in test_memcg_high_sync()
565 if (cg_write(memcg, "memory.max", "140M")) in test_memcg_high_sync()
578 post_high = cg_read_key_long(memcg, "memory.events", "high "); in test_memcg_high_sync()
579 post_max = cg_read_key_long(memcg, "memory.events", "max "); in test_memcg_high_sync()
598 * This test checks that memory.max limits the amount of
599 * memory which can be consumed by either anonymous memory
615 if (cg_read_strcmp(memcg, "memory.max", "max\n")) in test_memcg_max()
618 if (cg_write(memcg, "memory.swap.max", "0")) in test_memcg_max()
621 if (cg_write(memcg, "memory.max", "30M")) in test_memcg_max()
631 current = cg_read_long(memcg, "memory.current"); in test_memcg_max()
635 max = cg_read_key_long(memcg, "memory.events", "max "); in test_memcg_max()
649 * This test checks that memory.reclaim reclaims the given
650 * amount of memory (from both anon and file, if possible).
666 current = cg_read_long(memcg, "memory.current"); in test_memcg_reclaim()
691 while (!values_close(cg_read_long(memcg, "memory.current"), in test_memcg_reclaim()
712 current = cg_read_long(memcg, "memory.current"); in test_memcg_reclaim()
724 err = cg_write(memcg, "memory.reclaim", buf); in test_memcg_reclaim()
730 current = cg_read_long(memcg, "memory.current"); in test_memcg_reclaim()
765 mem_current = cg_read_long(cgroup, "memory.current"); in alloc_anon_50M_check_swap()
769 swap_current = cg_read_long(cgroup, "memory.swap.current"); in alloc_anon_50M_check_swap()
781 * This test checks that memory.swap.max limits the amount of
782 * anonymous memory which can be swapped out.
800 if (cg_read_long(memcg, "memory.swap.current")) { in test_memcg_swap_max()
805 if (cg_read_strcmp(memcg, "memory.max", "max\n")) in test_memcg_swap_max()
808 if (cg_read_strcmp(memcg, "memory.swap.max", "max\n")) in test_memcg_swap_max()
811 if (cg_write(memcg, "memory.swap.max", "30M")) in test_memcg_swap_max()
814 if (cg_write(memcg, "memory.max", "30M")) in test_memcg_swap_max()
821 if (cg_read_key_long(memcg, "memory.events", "oom ") != 1) in test_memcg_swap_max()
824 if (cg_read_key_long(memcg, "memory.events", "oom_kill ") != 1) in test_memcg_swap_max()
830 max = cg_read_key_long(memcg, "memory.events", "max "); in test_memcg_swap_max()
844 * This test disables swapping and tries to allocate anonymous memory
846 * memory.events.
860 if (cg_write(memcg, "memory.max", "30M")) in test_memcg_oom_events()
863 if (cg_write(memcg, "memory.swap.max", "0")) in test_memcg_oom_events()
872 if (cg_read_key_long(memcg, "memory.events", "oom ") != 1) in test_memcg_oom_events()
875 if (cg_read_key_long(memcg, "memory.events", "oom_kill ") != 1) in test_memcg_oom_events()
978 current = cg_read_long(cgroup, "memory.current"); in tcp_client()
979 sock = cg_read_key_long(cgroup, "memory.stat", "sock "); in tcp_client()
998 * This test checks socket memory accounting.
1003 * memory.current and memory.stat.sock are similar.
1055 if (cg_read_long(memcg, "memory.current") < 0) in test_memcg_sock()
1058 if (cg_read_key_long(memcg, "memory.stat", "sock ")) in test_memcg_sock()
1071 * This test disables swapping and tries to allocate anonymous memory
1072 * up to OOM with memory.group.oom set. Then it checks that all
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()
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()
1144 * This test disables swapping and tries to allocate anonymous memory
1145 * up to OOM with memory.group.oom set. Then it checks that all
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()
1200 * This test disables swapping and tries to allocate anonymous memory
1201 * up to OOM with memory.group.oom set. Then it checks that all
1218 if (cg_write(memcg, "memory.max", "50M")) in test_memcg_oom_group_score_events()
1221 if (cg_write(memcg, "memory.swap.max", "0")) in test_memcg_oom_group_score_events()
1224 if (cg_write(memcg, "memory.oom.group", "1")) in test_memcg_oom_group_score_events()
1235 if (cg_read_key_long(memcg, "memory.events", "oom_kill ") != 3) in test_memcg_oom_group_score_events()
1282 * Check that memory controller is available: in main()
1283 * memory is listed in cgroup.controllers in main()
1285 if (cg_read_strstr(root, "cgroup.controllers", "memory")) in main()
1286 ksft_exit_skip("memory controller isn't available\n"); in main()
1288 if (cg_read_strstr(root, "cgroup.subtree_control", "memory")) in main()
1289 if (cg_write(root, "cgroup.subtree_control", "+memory")) in main()
1290 ksft_exit_skip("Failed to set memory controller\n"); in main()