Lines Matching +full:parent +full:- +full:child
1 // SPDX-License-Identifier: GPL-2.0
38 "/something-non-existent-with-a-long-name-%64lu-%d", in alloc_dcache()
101 int ret = -1; in alloc_kmem_smp()
105 return -1; in alloc_kmem_smp()
111 return -1; in alloc_kmem_smp()
125 static int cg_run_in_subcgroups(const char *parent, in cg_run_in_subcgroups() argument
129 char *child; in cg_run_in_subcgroups() local
133 child = cg_name_indexed(parent, "child", i); in cg_run_in_subcgroups()
134 if (!child) in cg_run_in_subcgroups()
135 return -1; in cg_run_in_subcgroups()
137 if (cg_create(child)) { in cg_run_in_subcgroups()
138 cg_destroy(child); in cg_run_in_subcgroups()
139 free(child); in cg_run_in_subcgroups()
140 return -1; in cg_run_in_subcgroups()
143 if (cg_run(child, fn, NULL)) { in cg_run_in_subcgroups()
144 cg_destroy(child); in cg_run_in_subcgroups()
145 free(child); in cg_run_in_subcgroups()
146 return -1; in cg_run_in_subcgroups()
149 cg_destroy(child); in cg_run_in_subcgroups()
150 free(child); in cg_run_in_subcgroups()
159 * threads. Then it checks the sanity of numbers on the parent level:
167 char *parent; in test_kmem_memcg_deletion() local
169 parent = cg_name(root, "kmem_memcg_deletion_test"); in test_kmem_memcg_deletion()
170 if (!parent) in test_kmem_memcg_deletion()
173 if (cg_create(parent)) in test_kmem_memcg_deletion()
176 if (cg_write(parent, "cgroup.subtree_control", "+memory")) in test_kmem_memcg_deletion()
179 if (cg_run_in_subcgroups(parent, alloc_kmem_smp, NULL, 100)) in test_kmem_memcg_deletion()
182 current = cg_read_long(parent, "memory.current"); in test_kmem_memcg_deletion()
183 slab = cg_read_key_long(parent, "memory.stat", "slab "); in test_kmem_memcg_deletion()
184 anon = cg_read_key_long(parent, "memory.stat", "anon "); in test_kmem_memcg_deletion()
185 file = cg_read_key_long(parent, "memory.stat", "file "); in test_kmem_memcg_deletion()
186 kernel_stack = cg_read_key_long(parent, "memory.stat", "kernel_stack "); in test_kmem_memcg_deletion()
192 if (abs(sum - current) < MAX_VMSTAT_ERROR) { in test_kmem_memcg_deletion()
204 cg_destroy(parent); in test_kmem_memcg_deletion()
205 free(parent); in test_kmem_memcg_deletion()
248 int ret = -1; in spawn_1000_threads()
252 return -1; in spawn_1000_threads()
258 return(-1); in spawn_1000_threads()
298 * This test sequentionally creates 30 child cgroups, allocates some
300 * that the number of dying cgroups on the parent level is 0.
305 char *parent; in test_kmem_dead_cgroups() local
309 parent = cg_name(root, "kmem_dead_cgroups_test"); in test_kmem_dead_cgroups()
310 if (!parent) in test_kmem_dead_cgroups()
313 if (cg_create(parent)) in test_kmem_dead_cgroups()
316 if (cg_write(parent, "cgroup.subtree_control", "+memory")) in test_kmem_dead_cgroups()
319 if (cg_run_in_subcgroups(parent, alloc_dcache, (void *)100, 30)) in test_kmem_dead_cgroups()
323 dead = cg_read_key_long(parent, "cgroup.stat", in test_kmem_dead_cgroups()
337 cg_destroy(parent); in test_kmem_dead_cgroups()
338 free(parent); in test_kmem_dead_cgroups()
344 * This test creates a sub-tree with 1000 memory cgroups.
345 * Then it checks that the memory.current on the parent level
352 char *parent, *child; in test_percpu_basic() local
356 parent = cg_name(root, "percpu_basic_test"); in test_percpu_basic()
357 if (!parent) in test_percpu_basic()
360 if (cg_create(parent)) in test_percpu_basic()
363 if (cg_write(parent, "cgroup.subtree_control", "+memory")) in test_percpu_basic()
367 child = cg_name_indexed(parent, "child", i); in test_percpu_basic()
368 if (!child) in test_percpu_basic()
369 return -1; in test_percpu_basic()
371 if (cg_create(child)) in test_percpu_basic()
374 free(child); in test_percpu_basic()
377 current = cg_read_long(parent, "memory.current"); in test_percpu_basic()
378 percpu = cg_read_key_long(parent, "memory.stat", "percpu "); in test_percpu_basic()
380 if (current > 0 && percpu > 0 && abs(current - percpu) < in test_percpu_basic()
389 child = cg_name_indexed(parent, "child", i); in test_percpu_basic()
390 cg_destroy(child); in test_percpu_basic()
391 free(child); in test_percpu_basic()
395 cg_destroy(parent); in test_percpu_basic()
396 free(parent); in test_percpu_basic()