Home
last modified time | relevance | path

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

1234567891011

/linux/tools/testing/selftests/cgroup/
H A 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 …]
H A Dtest_kill.c22 static int cg_kill_wait(const char *cgroup) in cg_kill_wait() argument
26 fd = cg_prepare_for_wait(cgroup); in cg_kill_wait()
30 ret = cg_write(cgroup, "cgroup.kill", "1"); in cg_kill_wait()
47 static int child_fn(const char *cgroup, void *arg) in child_fn() argument
61 char *cgroup = NULL; in test_cgkill_simple() local
64 cgroup = cg_name(root, "cg_test_simple"); in test_cgkill_simple()
65 if (!cgroup) in test_cgkill_simple()
68 if (cg_create(cgroup)) in test_cgkill_simple()
72 pids[i] = cg_run_nowait(cgroup, child_fn, NULL); in test_cgkill_simple()
74 if (cg_wait_for_proc_count(cgroup, 100)) in test_cgkill_simple()
[all …]
H A Dcgroup_util.h
H A Dcgroup_util.c
/linux/tools/testing/selftests/cgroup/lib/
H A Dcgroup_util.c79 char *cg_control(const char *cgroup, const char *control) in cg_control()
81 size_t len = strlen(cgroup) + strlen(control) + 2; in cg_control()
85 snprintf(ret, len, "%s/%s", cgroup, control); in cg_control()
91 int cg_read(const char *cgroup, const char *control, char *buf, size_t len) in cg_read()
96 snprintf(path, sizeof(path), "%s/%s", cgroup, control); in cg_read()
102 int cg_read_strcmp(const char *cgroup, const char *control, in cg_read_strcmp()
120 if (cg_read(cgroup, control, buf, size)) { in cg_read_strcmp()
130 int cg_read_strcmp_wait(const char *cgroup, const char *control, in cg_read_strcmp_wait()
136 ret = cg_read_strcmp(cgroup, control, expected); in cg_read_strcmp_wait()
145 int cg_read_strstr(const char *cgroup, cons in cg_read_strstr()
77 cg_control(const char * cgroup,const char * control) cg_control() argument
88 cg_read(const char * cgroup,const char * control,char * buf,size_t len) cg_read() argument
99 cg_read_strcmp(const char * cgroup,const char * control,const char * expected) cg_read_strcmp() argument
127 cg_read_strcmp_wait(const char * cgroup,const char * control,const char * expected) cg_read_strcmp_wait() argument
142 cg_read_strstr(const char * cgroup,const char * control,const char * needle) cg_read_strstr() argument
152 cg_read_long(const char * cgroup,const char * control) cg_read_long() argument
172 cg_read_key_long(const char * cgroup,const char * control,const char * key) cg_read_key_long() argument
187 cg_read_key_long_poll(const char * cgroup,const char * control,const char * key,long expected,int retries,useconds_t wait_interval_us) cg_read_key_long_poll() argument
208 cg_read_lc(const char * cgroup,const char * control) cg_read_lc() argument
225 cg_write(const char * cgroup,const char * control,char * buf) cg_write() argument
239 cg_open(const char * cgroup,const char * control,int flags) cg_open() argument
247 cg_write_numeric(const char * cgroup,const char * control,long value) cg_write_numeric() argument
310 cg_create(const char * cgroup) cg_create() argument
315 cg_wait_for_proc_count(const char * cgroup,int count) cg_wait_for_proc_count() argument
340 cg_killall(const char * cgroup) cg_killall() argument
368 cg_destroy(const char * cgroup) cg_destroy() argument
388 cg_enter(const char * cgroup,int pid) cg_enter() argument
396 cg_enter_current(const char * cgroup) cg_enter_current() argument
401 cg_enter_current_thread(const char * cgroup) cg_enter_current_thread() argument
406 cg_run(const char * cgroup,int (* fn)(const char * cgroup,void * arg),void * arg) cg_run() argument
407 cg_run(const char * cgroup,int (* fn)(const char * cgroup,void * arg),void * arg) cg_run() argument
504 clone_into_cgroup_run_nowait(const char * cgroup,int (* fn)(const char * cgroup,void * arg),void * arg) clone_into_cgroup_run_nowait() argument
505 clone_into_cgroup_run_nowait(const char * cgroup,int (* fn)(const char * cgroup,void * arg),void * arg) clone_into_cgroup_run_nowait() argument
523 cg_run_nowait(const char * cgroup,int (* fn)(const char * cgroup,void * arg),void * arg) cg_run_nowait() argument
524 cg_run_nowait(const char * cgroup,int (* fn)(const char * cgroup,void * arg),void * arg) cg_run_nowait() argument
599 clone_into_cgroup_run_wait(const char * cgroup) clone_into_cgroup_run_wait() argument
624 __prepare_for_wait(const char * cgroup,const char * filename) __prepare_for_wait() argument
641 cg_prepare_for_wait(const char * cgroup) cg_prepare_for_wait() argument
646 memcg_prepare_for_wait(const char * cgroup) memcg_prepare_for_wait() argument
[all...]
/linux/tools/testing/selftests/cgroup/lib/include/
H A Dcgroup_util.h59 extern char *cg_control(const char *cgroup, const char *control);
60 extern int cg_create(const char *cgroup);
61 extern int cg_destroy(const char *cgroup);
62 extern int cg_read(const char *cgroup, const char *control,
64 extern int cg_read_strcmp(const char *cgroup, const char *control,
66 extern int cg_read_strcmp_wait(const char *cgroup, const char *control,
68 extern int cg_read_strstr(const char *cgroup, const char *control,
70 extern long cg_read_long(const char *cgroup, const char *control);
72 long cg_read_key_long(const char *cgroup, const char *control, const char *key);
73 long cg_read_key_long_poll(const char *cgroup, const char *control,
[all …]
/linux/tools/testing/selftests/bpf/progs/
H A 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 …]
H A Dcgroup_read_xattr.c15 static __always_inline void read_xattr(struct cgroup *cgroup) in read_xattr() argument
20 bpf_cgroup_read_xattr(cgroup, "user.bpf_test", in read_xattr()
29 struct cgroup *cgrp; in BPF_PROG()
45 struct cgroup *cgrp; in BPF_PROG()
62 struct cgroup *cgrp; in BPF_PROG()
69 read_xattr(css->cgroup); in BPF_PROG()
81 struct cgroup *cgrp; in BPF_PROG()
88 read_xattr(css->cgroup); in BPF_PROG()
100 struct cgroup *cgr in BPF_PROG()
[all...]
H A 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()
H A Dcgrp_kfunc_success.c17 * TP_PROTO(struct cgroup *cgrp, const char *path),
33 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 *sel in BPF_PROG()
[all...]
H A Diters_css_task.c13 struct cgroup *bpf_cgroup_acquire(struct cgroup *p) __ksym;
14 struct cgroup *bpf_cgroup_from_id(u64 cgid) __ksym;
15 void bpf_cgroup_release(struct cgroup *p) __ksym;
28 struct cgroup *cgrp; in BPF_PROG()
50 static inline u64 cgroup_id(struct cgroup *cgrp) in cgroup_id()
59 struct cgroup *cgrp = ctx->cgroup; in cgroup_id_printer()
89 struct cgroup *cgrp = bpf_cgroup_from_id(cgrp_id); in BPF_PROG()
/linux/tools/perf/util/
H A Dcgroup.c4 #include "cgroup.h"
24 /* used to match cgroup name with patterns */
46 fprintf(stderr, "no access to cgroup %s\n", path); in open_cgroup()
67 int read_cgroup_id(struct cgroup *cgrp) in read_cgroup_id()
102 static struct cgroup *evlist__find_cgroup(struct evlist *evlist, const char *str) in evlist__find_cgroup()
118 struct cgroup *cgroup__new(const char *name, bool do_open) in cgroup__new()
120 struct cgroup *cgroup = zalloc(sizeof(*cgroup)); in cgroup__new() local
122 if (cgroup ! in cgroup__new()
149 struct cgroup *cgroup = evlist__find_cgroup(evlist, name); evlist__findnew_cgroup() local
180 cgroup__delete(struct cgroup * cgroup) cgroup__delete() argument
195 cgroup__get(struct cgroup * cgroup) cgroup__get() argument
202 evsel__set_default_cgroup(struct evsel * evsel,struct cgroup * cgroup) evsel__set_default_cgroup() argument
208 evlist__set_default_cgroup(struct evlist * evlist,struct cgroup * cgroup) evlist__set_default_cgroup() argument
[all...]
H A Dcgroup.h12 struct cgroup { struct
23 struct cgroup *cgroup__get(struct cgroup *cgroup); argument
24 void cgroup__put(struct cgroup *cgroup);
29 struct cgroup *cgroup__new(const char *name, bool do_open);
30 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);
40 struct cgroup *__cgroup__find(struct rb_root *root, uint64_t id);
45 int read_cgroup_id(struct cgroup *cgrp);
[all …]
/linux/tools/bpf/bpftool/Documentation/
H A 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**
52 bpftool cgroup { show | list } *CGROUP* [effective]
53 List all programs attached to the cgroup *CGROUP*.
59 for events within a cgroup. This includes inherited along with attached
[all …]
/linux/Documentation/admin-guide/cgroup-v1/
H A Dpids.rst8 The process number controller is used to allow a cgroup hierarchy to stop any
13 preventable in the scope of a cgroup hierarchy by allowing resource limiting of
14 the number of tasks in a cgroup.
20 pids.max (this is not available in the root cgroup for obvious reasons). The
21 number of processes currently in the cgroup is given by pids.current.
23 Organisational operations are not blocked by cgroup policies, so it is possible
25 be smaller than pids.current, or attaching enough processes to the cgroup such
26 that pids.current > pids.max. However, it is not possible to violate a cgroup
28 creation of a new process would cause a cgroup policy to be violated.
30 To set a cgroup to have no limit, set pids.max to "max". This is the default for
[all …]
H A Dnet_cls.rst2 Network classifier cgroup
5 The Network classifier cgroup provides an interface to
23 mkdir /sys/fs/cgroup/net_cls
24 mount -t cgroup -onet_cls net_cls /sys/fs/cgroup/net_cls
25 mkdir /sys/fs/cgroup/net_cls/0
26 echo 0x100001 > /sys/fs/cgroup/net_cls/0/net_cls.classid
30 cat /sys/fs/cgroup/net_cls/0/net_cls.classid
40 tc filter add dev eth0 parent 10: protocol ip prio 10 handle 1: cgroup
44 iptables -A OUTPUT -m cgroup ! --cgroup 0x100001 -j DROP
H A Dcpuacct.rst12 Accounting groups can be created by first mounting the cgroup filesystem::
14 # mount -t cgroup -ocpuacct none /sys/fs/cgroup
17 visible at /sys/fs/cgroup. At bootup, this group includes all the tasks in
18 the system. /sys/fs/cgroup/tasks lists the tasks in this cgroup.
19 /sys/fs/cgroup/cpuacct.usage gives the CPU time (in nanoseconds) obtained
23 New accounting groups can be created under the parent group /sys/fs/cgroup::
25 # cd /sys/fs/cgroup
32 /sys/fs/cgroup/cpuacct.usage also.
35 CPU time obtained by the cgroup into user and system times. Currently
38 user: Time spent by tasks of the cgroup in user mode.
[all …]
H A Dmemcg_test.rst13 (*) Topics on API should be in Documentation/admin-guide/cgroup-v1/memory.rst
166 mount -t cgroup -o cpuset none /opt/cpuset
216 mkdir /opt/cgroup/01/child_a
217 mkdir /opt/cgroup/01/child_b
225 /opt/cgroup/01/child_a/child_aa
226 /opt/cgroup/01/child_b/child_bb
227 /opt/cgroup/01/child_c
235 race and lock dependency with other cgroup subsystems.
239 # mount -t cgroup none /cgroup -o cpuset,memory,cpu,devices
254 # mount -t cgroup none /cgroup -o memory
[all …]
H A Dnet_prio.rst2 Network priority cgroup
5 The Network priority cgroup provides an interface to allow an administrator to
16 This cgroup allows an administrator to assign a process to a group which defines
18 be created by first mounting the cgroup filesystem::
20 # mount -t cgroup -onet_prio none /sys/fs/cgroup/net_prio
23 becomes visible at '/sys/fs/cgroup/net_prio'. This group includes all tasks in
24 the system. '/sys/fs/cgroup/net_prio/tasks' lists the tasks in this cgroup.
26 Each net_prio cgroup contains two files that are subsystem specific
31 cgroup.
43 iscsi net_prio cgroup and egressing on interface eth0 to have the priority of
[all …]
/linux/Documentation/admin-guide/
H A Dcgroup-v2.rst11 conventions of cgroup v2. It describes all userland-visible aspects
12 of cgroup including core and specific controller behaviors. All
14 v1 is available under :ref:`Documentation/admin-guide/cgroup-v1/index.rst <cgroup-v1>`.
23 1-2. What is cgroup?
82 5-N-1. CPU controller root cgroup process behaviour
83 5-N-2. IO controller root cgroup process behaviour
107 "cgroup" stands for "control group" and is never capitalized. The
109 qualifier as in "cgroup controllers". When explicitly referring to
113 What is cgroup?
116 cgroup is a mechanism to organize processes hierarchically and
[all …]
/linux/kernel/cgroup/
H A Dcgroup.c272 static int cgroup_apply_control(struct cgroup *cgrp);
273 static void cgroup_finalize_control(struct cgroup *cgrp, int ret);
276 static int cgroup_destroy_locked(struct cgroup *cgrp);
279 static struct cgroup_subsys_state *css_create(struct cgroup *cgrp,
283 struct cgroup *cgrp, struct cftype cfts[],
352 bool cgroup_on_dfl(const struct cgroup *cgrp) in cgroup_on_dfl()
388 static bool cgroup_is_threaded(struct cgroup *cgrp) in cgroup_is_threaded()
394 static bool cgroup_is_mixable(struct cgroup *cgrp) in cgroup_is_mixable()
405 static bool cgroup_can_be_thread_root(struct cgroup *cgrp) in cgroup_can_be_thread_root()
427 static bool cgroup_is_thread_root(struct cgroup *cgrp) in cgroup_is_thread_root()
[all …]
H A Dfreezer.c15 static bool cgroup_update_frozen_flag(struct cgroup *cgrp, bool frozen) in cgroup_update_frozen_flag()
36 static void cgroup_propagate_frozen(struct cgroup *cgrp, bool frozen) in cgroup_propagate_frozen()
66 void cgroup_update_frozen(struct cgroup *cgrp) in cgroup_update_frozen()
86 static void cgroup_inc_frozen_cnt(struct cgroup *cgrp) in cgroup_inc_frozen_cnt()
94 static void cgroup_dec_frozen_cnt(struct cgroup *cgrp) in cgroup_dec_frozen_cnt()
106 struct cgroup *cgrp; in cgroup_enter_frozen()
130 struct cgroup *cgrp; in cgroup_leave_frozen()
174 static void cgroup_do_freeze(struct cgroup *cgrp, bool freeze, u64 ts_nsec) in cgroup_do_freeze()
226 struct cgroup *src, struct cgroup *dst) in cgroup_freezer_migrate_task()
263 void cgroup_freeze(struct cgroup *cgrp, bool freeze) in cgroup_freeze()
[all …]
/linux/tools/perf/tests/shell/
H A Dstat_bpf_counters_cgrp.sh2 # perf stat --bpf-counters --for-each-cgroup test
12 # skip if --bpf-counters --for-each-cgroup is not supported
15 if ! perf stat -a --bpf-counters --for-each-cgroup / true > /dev/null 2>&1; then
17 echo "Skipping: --bpf-counters --for-each-cgroup not supported"
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)
36 # cgroup v2 doesn't specify perf_event
37 find_cgroups_self_cgrp=$(grep ^0: /proc/self/cgroup | cu
[all...]
/linux/tools/testing/selftests/mm/
H A Dcharge_reserved_hugetlb.sh27 if [[ "$1" == "-cgroup-v2" ]]; then
42 echo "+hugetlb" >$cgroup_path/cgroup.subtree_control
44 cgroup_path=$(mount -t cgroup | grep ",hugetlb" | awk '{print $3}')
47 mount -t cgroup memory,hugetlb $cgroup_path
55 echo $$ >$cgroup_path/cgroup.procs
114 echo writing cgroup limit: "$cgroup_limit"
154 local cgroup="$1"
155 local path="$cgroup_path/$cgroup/hugetlb.${MB_DISPLAY}${UNIT}.$reservation_usage_file"
161 local cgroup="$1"
163 local path="$cgroup_path/$cgroup/hugetl
[all...]
H A Dhugetlb_reparenting_test.sh19 if [[ "$1" == "-cgroup-v2" ]]; then
32 echo "+hugetlb +memory" >$CGROUP_ROOT/cgroup.subtree_control
34 CGROUP_ROOT=$(mount -t cgroup | grep ",hugetlb" | awk '{print $3}')
36 CGROUP_ROOT=/dev/cgroup/memory
37 mount -t cgroup memory,hugetlb $CGROUP_ROOT
129 echo "+hugetlb +memory" >$CGROUP_ROOT/a/cgroup.subtree_control
147 local cgroup="$1"
152 cg_file="$CGROUP_ROOT/$cgroup/cgroup.procs"
154 echo 0 >$CGROUP_ROOT/$cgroup/cpuse
[all...]

1234567891011