Home
last modified time | relevance | path

Searched refs:cgroup (Results 1 – 25 of 106) sorted by relevance

12345

/tools/testing/selftests/cgroup/
Dtest_freezer.c27 static int cg_check_frozen(const char *cgroup, bool frozen) in cg_check_frozen() argument
30 if (cg_read_strstr(cgroup, "cgroup.events", "frozen 1") != 0) { in cg_check_frozen()
31 debug("Cgroup %s isn't frozen\n", cgroup); in cg_check_frozen()
38 if (cg_read_strstr(cgroup, "cgroup.events", "frozen 0") != 0) { in cg_check_frozen()
39 debug("Cgroup %s is frozen\n", cgroup); in cg_check_frozen()
50 static int cg_freeze_nowait(const char *cgroup, bool freeze) in cg_freeze_nowait() argument
52 return cg_write(cgroup, "cgroup.freeze", freeze ? "1" : "0"); in cg_freeze_nowait()
59 static int cg_enter_and_wait_for_frozen(const char *cgroup, int pid, in cg_enter_and_wait_for_frozen() argument
65 fd = cg_prepare_for_wait(cgroup); in cg_enter_and_wait_for_frozen()
69 ret = cg_enter(cgroup, pid); in cg_enter_and_wait_for_frozen()
[all …]
Dtest_kill.c21 static int cg_kill_wait(const char *cgroup) in cg_kill_wait() argument
25 fd = cg_prepare_for_wait(cgroup); in cg_kill_wait()
29 ret = cg_write(cgroup, "cgroup.kill", "1"); in cg_kill_wait()
46 static int child_fn(const char *cgroup, void *arg) in child_fn() argument
60 char *cgroup = NULL; in test_cgkill_simple() local
63 cgroup = cg_name(root, "cg_test_simple"); in test_cgkill_simple()
64 if (!cgroup) in test_cgkill_simple()
67 if (cg_create(cgroup)) in test_cgkill_simple()
71 pids[i] = cg_run_nowait(cgroup, child_fn, NULL); in test_cgkill_simple()
73 if (cg_wait_for_proc_count(cgroup, 100)) in test_cgkill_simple()
[all …]
Dcgroup_util.h27 extern char *cg_control(const char *cgroup, const char *control);
28 extern int cg_create(const char *cgroup);
29 extern int cg_destroy(const char *cgroup);
30 extern int cg_read(const char *cgroup, const char *control,
32 extern int cg_read_strcmp(const char *cgroup, const char *control,
34 extern int cg_read_strstr(const char *cgroup, const char *control,
36 extern long cg_read_long(const char *cgroup, const char *control);
37 long cg_read_key_long(const char *cgroup, const char *control, const char *key);
38 extern long cg_read_lc(const char *cgroup, const char *control);
39 extern int cg_write(const char *cgroup, const char *control, char *buf);
[all …]
Dcgroup_util.c75 char *cg_control(const char *cgroup, const char *control) in cg_control() argument
77 size_t len = strlen(cgroup) + strlen(control) + 2; in cg_control()
80 snprintf(ret, len, "%s/%s", cgroup, control); in cg_control()
86 int cg_read(const char *cgroup, const char *control, char *buf, size_t len) in cg_read() argument
91 snprintf(path, sizeof(path), "%s/%s", cgroup, control); in cg_read()
97 int cg_read_strcmp(const char *cgroup, const char *control, in cg_read_strcmp() argument
114 if (cg_read(cgroup, control, buf, size)) { in cg_read_strcmp()
124 int cg_read_strstr(const char *cgroup, const char *control, const char *needle) in cg_read_strstr() argument
128 if (cg_read(cgroup, control, buf, sizeof(buf))) in cg_read_strstr()
134 long cg_read_long(const char *cgroup, const char *control) in cg_read_long() argument
[all …]
Dtest_cpu.c23 char *cgroup; member
131 static int hog_cpus_timed(const char *cgroup, void *arg) in hog_cpus_timed() argument
253 children[i].cgroup = cg_name_indexed(parent, "cpucg_child", i); in run_cpucg_weight_test()
254 if (!children[i].cgroup) in run_cpucg_weight_test()
257 if (cg_create(children[i].cgroup)) in run_cpucg_weight_test()
260 if (cg_write_numeric(children[i].cgroup, "cpu.weight", in run_cpucg_weight_test()
283 children[i].usage = cg_read_key_long(children[i].cgroup, in run_cpucg_weight_test()
292 cg_destroy(children[i].cgroup); in run_cpucg_weight_test()
293 free(children[i].cgroup); in run_cpucg_weight_test()
312 return cg_run_nowait(child->cgroup, hog_cpus_timed, (void *)&param); in weight_hog_ncpus()
[all …]
Dwith_stress.sh19 echo $verb$subsys_ctrl >$sysfs/cgroup.subtree_control
34 if ! echo +$subsys_ctrl >$sysfs/cgroup.subtree_control ; then
39 if ! echo -$subsys_ctrl >$sysfs/cgroup.subtree_control ; then
Dtest_cpuset.c9 static int idle_process_fn(const char *cgroup, void *arg) in idle_process_fn() argument
15 static int do_migration_fn(const char *cgroup, void *arg) in do_migration_fn() argument
23 if (cg_enter(cgroup, object_pid) || in do_migration_fn()
24 cg_wait_for_proc_count(cgroup, 1)) in do_migration_fn()
30 static int do_controller_fn(const char *cgroup, void *arg) in do_controller_fn() argument
32 const char *child = cgroup; in do_controller_fn()
Dtest_memcontrol.c93 static int alloc_anon_50M_check(const char *cgroup, void *arg) in alloc_anon_50M_check() argument
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()
129 static int alloc_pagecache_50M_check(const char *cgroup, void *arg) in alloc_pagecache_50M_check() argument
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()
198 static int alloc_pagecache_50M_noexit(const char *cgroup, void *arg) in alloc_pagecache_50M_noexit() argument
212 static int alloc_anon_noexit(const char *cgroup, void *arg) in alloc_anon_noexit() argument
238 static int cg_test_proc_killed(const char *cgroup) in cg_test_proc_killed() argument
243 if (cg_read_strcmp(cgroup, "cgroup.procs", "") == 0) in cg_test_proc_killed()
[all …]
/tools/testing/selftests/bpf/progs/
Dcgrp_kfunc_failure.c20 static struct __cgrps_kfunc_map_value *insert_lookup_cgrp(struct cgroup *cgrp) in insert_lookup_cgrp()
33 int BPF_PROG(cgrp_kfunc_acquire_untrusted, struct cgroup *cgrp, const char *path) in BPF_PROG()
35 struct cgroup *acquired; in BPF_PROG()
52 int BPF_PROG(cgrp_kfunc_acquire_no_null_check, struct cgroup *cgrp, const char *path) in BPF_PROG()
54 struct cgroup *acquired; in BPF_PROG()
68 int BPF_PROG(cgrp_kfunc_acquire_fp, struct cgroup *cgrp, const char *path) in BPF_PROG()
70 struct cgroup *acquired, *stack_cgrp = (struct cgroup *)&path; in BPF_PROG()
73 acquired = bpf_cgroup_acquire((struct cgroup *)&stack_cgrp); in BPF_PROG()
82 int BPF_PROG(cgrp_kfunc_acquire_unsafe_kretprobe, struct cgroup *cgrp) in BPF_PROG()
84 struct cgroup *acquired; in BPF_PROG()
[all …]
Dcgrp_kfunc_common.h13 struct cgroup __kptr * cgrp;
23 struct cgroup *bpf_cgroup_acquire(struct cgroup *p) __ksym;
24 void bpf_cgroup_release(struct cgroup *p) __ksym;
25 struct cgroup *bpf_cgroup_ancestor(struct cgroup *cgrp, int level) __ksym;
26 struct cgroup *bpf_cgroup_from_id(u64 cgid) __ksym;
30 static inline struct __cgrps_kfunc_map_value *cgrps_kfunc_map_value_lookup(struct cgroup *cgrp) in cgrps_kfunc_map_value_lookup()
42 static inline int cgrps_kfunc_map_insert(struct cgroup *cgrp) in cgrps_kfunc_map_insert()
46 struct cgroup *acquired, *old; in cgrps_kfunc_map_insert()
Dcgrp_kfunc_success.c33 int BPF_PROG(test_cgrp_acquire_release_argument, struct cgroup *cgrp, const char *path) in BPF_PROG()
35 struct cgroup *acquired; in BPF_PROG()
50 int BPF_PROG(test_cgrp_acquire_leave_in_map, struct cgroup *cgrp, const char *path) in BPF_PROG()
65 int BPF_PROG(test_cgrp_xchg_release, struct cgroup *cgrp, const char *path) in BPF_PROG()
67 struct cgroup *kptr, *cg; in BPF_PROG()
108 int BPF_PROG(test_cgrp_get_release, struct cgroup *cgrp, const char *path) in BPF_PROG()
110 struct cgroup *kptr; in BPF_PROG()
139 int BPF_PROG(test_cgrp_get_ancestors, struct cgroup *cgrp, const char *path) in BPF_PROG()
141 struct cgroup *self, *ancestor1, *invalid; in BPF_PROG()
184 int BPF_PROG(test_cgrp_from_id, struct cgroup *cgrp, const char *path) in BPF_PROG()
[all …]
Dtest_task_under_cgroup.c10 struct cgroup *bpf_cgroup_from_id(u64 cgid) __ksym;
11 long bpf_task_under_cgroup(struct task_struct *task, struct cgroup *ancestor) __ksym;
12 void bpf_cgroup_release(struct cgroup *p) __ksym;
23 struct cgroup *cgrp = NULL; in BPF_PROG()
Dcgroup_hierarchical_stats.c40 extern void cgroup_rstat_updated(struct cgroup *cgrp, int cpu) __ksym;
41 extern void cgroup_rstat_flush(struct cgroup *cgrp) __ksym;
43 static uint64_t cgroup_id(struct cgroup *cgrp) in cgroup_id()
65 int BPF_PROG(counter, struct cgroup *dst_cgrp, struct task_struct *leader, in BPF_PROG()
83 int BPF_PROG(flusher, struct cgroup *cgrp, struct cgroup *parent, int cpu) in BPF_PROG()
133 int BPF_PROG(dumper, struct bpf_iter_meta *meta, struct cgroup *cgrp) in BPF_PROG()
Dcgroup_iter.c12 static inline u64 cgroup_id(struct cgroup *cgrp) in cgroup_id()
21 struct cgroup *cgrp = ctx->cgroup; in cgroup_id_printer()
Dcgrp_ls_sleepable.c27 struct cgroup *cgrp = ctx->cgroup; in cgroup_iter()
44 struct cgroup *cgrp; in no_rcu_lock()
64 struct cgroup *cgrp; in yes_rcu_lock()
Dcgrp_ls_attach_cgroup.c42 tcp_sk->inet_conn.icsk_inet.sk.sk_cgrp_data.cgroup, 0, in set_cookie()
71 tcp_sk->inet_conn.icsk_inet.sk.sk_cgrp_data.cgroup, 0, 0); in update_cookie_sockops()
91 p = bpf_cgrp_storage_get(&socket_cookies, sock->sk->sk_cgrp_data.cgroup, 0, 0); in BPF_PROG()
/tools/perf/util/
Dcgroup.h12 struct cgroup { struct
23 struct cgroup *cgroup__get(struct cgroup *cgroup); argument
24 void cgroup__put(struct cgroup *cgroup);
29 struct cgroup *evlist__findnew_cgroup(struct evlist *evlist, const char *name);
33 void evlist__set_default_cgroup(struct evlist *evlist, struct cgroup *cgroup);
37 struct cgroup *cgroup__findnew(struct perf_env *env, uint64_t id,
39 struct cgroup *cgroup__find(struct perf_env *env, uint64_t id);
44 int read_cgroup_id(struct cgroup *cgrp);
46 static inline int read_cgroup_id(struct cgroup *cgrp __maybe_unused) in read_cgroup_id()
Dcgroup.c51 int read_cgroup_id(struct cgroup *cgrp) in read_cgroup_id()
93 static struct cgroup *evlist__find_cgroup(struct evlist *evlist, const char *str) in evlist__find_cgroup()
109 static struct cgroup *cgroup__new(const char *name, bool do_open) in cgroup__new()
111 struct cgroup *cgroup = zalloc(sizeof(*cgroup)); in cgroup__new() local
113 if (cgroup != NULL) { in cgroup__new()
114 refcount_set(&cgroup->refcnt, 1); in cgroup__new()
116 cgroup->name = strdup(name); in cgroup__new()
117 if (!cgroup->name) in cgroup__new()
121 cgroup->fd = open_cgroup(name); in cgroup__new()
122 if (cgroup->fd == -1) in cgroup__new()
[all …]
/tools/bpf/bpftool/Documentation/
Dbpftool-cgroup.rst4 bpftool-cgroup
17 **bpftool** [*OPTIONS*] **cgroup** *COMMAND*
27 | **bpftool** **cgroup** { **show** | **list** } *CGROUP* [**effective**]
28 | **bpftool** **cgroup tree** [*CGROUP_ROOT*] [**effective**]
29 | **bpftool** **cgroup attach** *CGROUP* *ATTACH_TYPE* *PROG* [*ATTACH_FLAGS*]
30 | **bpftool** **cgroup detach** *CGROUP* *ATTACH_TYPE* *PROG*
31 | **bpftool** **cgroup help**
49 **bpftool cgroup { show | list }** *CGROUP* [**effective**]
50 List all programs attached to the cgroup *CGROUP*.
56 will execute for events within a cgroup. This includes
[all …]
/tools/perf/tests/shell/
Dstat_bpf_counters_cgrp.sh15 if ! perf stat -a --bpf-counters --for-each-cgroup / true > /dev/null 2>&1; then
18 perf --no-pager stat -a --bpf-counters --for-each-cgroup / true || true
28 if [ -d /sys/fs/cgroup/system.slice ] && [ -d /sys/fs/cgroup/user.slice ]; then
34 find_cgroups_self_cgrp=$(grep perf_event /proc/self/cgroup | cut -d: -f3)
37 find_cgroups_self_cgrp=$(grep ^0: /proc/self/cgroup | cut -d: -f3)
51 …check_system_wide_counted_output=$(perf stat -a --bpf-counters --for-each-cgroup ${test_cgroups} -…
63 …check_cpu_list_counted_output=$(perf stat -C 0,1 --bpf-counters --for-each-cgroup ${test_cgroups} …
/tools/testing/selftests/mm/
Dwrite_hugetlb_memory.sh9 cgroup=$4
16 echo "Putting task in cgroup '$cgroup'"
17 echo $$ > ${cgroup_path:-/dev/cgroup/memory}/"$cgroup"/cgroup.procs
Dhugetlb_reparenting_test.sh25 CGROUP_ROOT=/dev/cgroup/memory
29 echo "+hugetlb +memory" >$CGROUP_ROOT/cgroup.subtree_control
31 CGROUP_ROOT=$(mount -t cgroup | grep ",hugetlb" | awk '{print $3}')
33 CGROUP_ROOT=/dev/cgroup/memory
34 mount -t cgroup memory,hugetlb $CGROUP_ROOT
132 echo "+hugetlb +memory" >$CGROUP_ROOT/a/cgroup.subtree_control
150 local cgroup="$1"
155 echo $$ >$CGROUP_ROOT/$cgroup/cgroup.procs
157 echo 0 >$CGROUP_ROOT/$cgroup/cpuset.mems
158 echo 0 >$CGROUP_ROOT/$cgroup/cpuset.cpus
[all …]
Dcharge_reserved_hugetlb.sh30 cgroup_path=/dev/cgroup/memory
34 echo "+hugetlb" >$cgroup_path/cgroup.subtree_control
36 cgroup_path=$(mount -t cgroup | grep ",hugetlb" | awk '{print $3}')
38 cgroup_path=/dev/cgroup/memory
39 mount -t cgroup memory,hugetlb $cgroup_path
47 echo $$ >$cgroup_path/cgroup.procs
98 echo writing cgroup limit: "$cgroup_limit"
114 local cgroup="$1"
115 local path="$cgroup_path/$cgroup/hugetlb.${MB}MB.$reservation_usage_file"
125 local cgroup="$1"
[all …]
/tools/perf/util/bpf_skel/vmlinux/
Dvmlinux.h74 struct cgroup { struct
80 struct cgroup *cgroup; argument
85 struct cgroup *dfl_cgrp;
/tools/testing/selftests/bpf/prog_tests/
Dcgroup_iter.c62 linfo.cgroup.cgroup_fd = cgroup_fd; in read_from_cgroup_iter()
63 linfo.cgroup.order = order; in read_from_cgroup_iter()
102 linfo.cgroup.cgroup_fd = (__u32)-1; in test_invalid_cgroup()
119 linfo.cgroup.cgroup_fd = (__u32)cg_fd[PARENT]; in test_invalid_cgroup_spec()
120 linfo.cgroup.cgroup_id = (__u64)cg_id[PARENT]; in test_invalid_cgroup_spec()
213 linfo.cgroup.cgroup_fd = cgrp_fd; in test_walk_dead_self_only()
214 linfo.cgroup.order = BPF_CGROUP_ITER_SELF_ONLY; in test_walk_dead_self_only()

12345