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()
105 int ret = -1; in alloc_kmem_smp()
109 return -1; in alloc_kmem_smp()
115 return -1; in alloc_kmem_smp()
129 static int cg_run_in_subcgroups(const char *parent, in cg_run_in_subcgroups() argument
133 char *child; in cg_run_in_subcgroups() local
137 child = cg_name_indexed(parent, "child", i); in cg_run_in_subcgroups()
138 if (!child) in cg_run_in_subcgroups()
139 return -1; in cg_run_in_subcgroups()
141 if (cg_create(child)) { in cg_run_in_subcgroups()
142 cg_destroy(child); in cg_run_in_subcgroups()
143 free(child); in cg_run_in_subcgroups()
144 return -1; in cg_run_in_subcgroups()
147 if (cg_run(child, fn, NULL)) { in cg_run_in_subcgroups()
148 cg_destroy(child); in cg_run_in_subcgroups()
149 free(child); in cg_run_in_subcgroups()
150 return -1; in cg_run_in_subcgroups()
153 cg_destroy(child); in cg_run_in_subcgroups()
154 free(child); in cg_run_in_subcgroups()
163 * threads. Then it checks the sanity of numbers on the parent level:
171 char *parent; in test_kmem_memcg_deletion() local
173 parent = cg_name(root, "kmem_memcg_deletion_test"); in test_kmem_memcg_deletion()
174 if (!parent) in test_kmem_memcg_deletion()
177 if (cg_create(parent)) in test_kmem_memcg_deletion()
180 if (cg_write(parent, "cgroup.subtree_control", "+memory")) in test_kmem_memcg_deletion()
183 if (cg_run_in_subcgroups(parent, alloc_kmem_smp, NULL, 100)) in test_kmem_memcg_deletion()
186 current = cg_read_long(parent, "memory.current"); in test_kmem_memcg_deletion()
187 anon = cg_read_key_long(parent, "memory.stat", "anon "); in test_kmem_memcg_deletion()
188 file = cg_read_key_long(parent, "memory.stat", "file "); in test_kmem_memcg_deletion()
189 kernel = cg_read_key_long(parent, "memory.stat", "kernel "); in test_kmem_memcg_deletion()
190 sock = cg_read_key_long(parent, "memory.stat", "sock "); in test_kmem_memcg_deletion()
195 if (abs(sum - current) < MAX_VMSTAT_ERROR) { in test_kmem_memcg_deletion()
207 cg_destroy(parent); in test_kmem_memcg_deletion()
208 free(parent); in test_kmem_memcg_deletion()
251 int ret = -1; in spawn_1000_threads()
255 return -1; in spawn_1000_threads()
261 return(-1); in spawn_1000_threads()
301 * This test sequentionally creates 30 child cgroups, allocates some
303 * that the number of dying cgroups on the parent level is 0.
308 char *parent; in test_kmem_dead_cgroups() local
312 parent = cg_name(root, "kmem_dead_cgroups_test"); in test_kmem_dead_cgroups()
313 if (!parent) in test_kmem_dead_cgroups()
316 if (cg_create(parent)) in test_kmem_dead_cgroups()
319 if (cg_write(parent, "cgroup.subtree_control", "+memory")) in test_kmem_dead_cgroups()
322 if (cg_run_in_subcgroups(parent, alloc_dcache, (void *)100, 30)) in test_kmem_dead_cgroups()
326 dead = cg_read_key_long(parent, "cgroup.stat", in test_kmem_dead_cgroups()
340 cg_destroy(parent); in test_kmem_dead_cgroups()
341 free(parent); in test_kmem_dead_cgroups()
347 * This test creates a sub-tree with 1000 memory cgroups.
348 * Then it checks that the memory.current on the parent level
355 char *parent, *child; in test_percpu_basic() local
359 parent = cg_name(root, "percpu_basic_test"); in test_percpu_basic()
360 if (!parent) in test_percpu_basic()
363 if (cg_create(parent)) in test_percpu_basic()
366 if (cg_write(parent, "cgroup.subtree_control", "+memory")) in test_percpu_basic()
370 child = cg_name_indexed(parent, "child", i); in test_percpu_basic()
371 if (!child) in test_percpu_basic()
372 return -1; in test_percpu_basic()
374 if (cg_create(child)) in test_percpu_basic()
377 free(child); in test_percpu_basic()
380 current = cg_read_long(parent, "memory.current"); in test_percpu_basic()
381 percpu = cg_read_key_long(parent, "memory.stat", "percpu "); in test_percpu_basic()
383 if (current > 0 && percpu > 0 && abs(current - percpu) < in test_percpu_basic()
392 child = cg_name_indexed(parent, "child", i); in test_percpu_basic()
393 cg_destroy(child); in test_percpu_basic()
394 free(child); in test_percpu_basic()
398 cg_destroy(parent); in test_percpu_basic()
399 free(parent); in test_percpu_basic()