Home
last modified time | relevance | path

Searched refs:cgroup (Results 1 – 25 of 259) 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.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 …]
H A 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);
38 long cg_read_key_long(const char *cgroup, const char *control, const char *key);
39 extern long cg_read_lc(const char *cgroup, const char *control);
40 extern int cg_write(const char *cgroup, cons
[all...]
H A Dcgroup_util.c75 char *cg_control(const char *cgroup, const char *control) in cg_control()
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()
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()
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()
128 if (cg_read(cgroup, control, buf, sizeof(buf))) in cg_read_strstr()
134 long cg_read_long(const char *cgroup, cons in cg_read_long()
72 cg_control(const char * cgroup,const char * control) cg_control() argument
83 cg_read(const char * cgroup,const char * control,char * buf,size_t len) cg_read() argument
94 cg_read_strcmp(const char * cgroup,const char * control,const char * expected) cg_read_strcmp() argument
121 cg_read_strstr(const char * cgroup,const char * control,const char * needle) cg_read_strstr() argument
131 cg_read_long(const char * cgroup,const char * control) cg_read_long() argument
141 cg_read_key_long(const char * cgroup,const char * control,const char * key) cg_read_key_long() argument
156 cg_read_lc(const char * cgroup,const char * control) cg_read_lc() argument
173 cg_write(const char * cgroup,const char * control,char * buf) cg_write() argument
183 cg_write_numeric(const char * cgroup,const char * control,long value) cg_write_numeric() argument
226 cg_create(const char * cgroup) cg_create() argument
231 cg_wait_for_proc_count(const char * cgroup,int count) cg_wait_for_proc_count() argument
256 cg_killall(const char * cgroup) cg_killall() argument
284 cg_destroy(const char * cgroup) cg_destroy() argument
304 cg_enter(const char * cgroup,int pid) cg_enter() argument
312 cg_enter_current(const char * cgroup) cg_enter_current() argument
317 cg_enter_current_thread(const char * cgroup) cg_enter_current_thread() argument
322 cg_run(const char * cgroup,int (* fn)(const char * cgroup,void * arg),void * arg) cg_run() argument
323 cg_run(const char * cgroup,int (* fn)(const char * cgroup,void * arg),void * arg) cg_run() argument
420 clone_into_cgroup_run_nowait(const char * cgroup,int (* fn)(const char * cgroup,void * arg),void * arg) clone_into_cgroup_run_nowait() argument
421 clone_into_cgroup_run_nowait(const char * cgroup,int (* fn)(const char * cgroup,void * arg),void * arg) clone_into_cgroup_run_nowait() argument
439 cg_run_nowait(const char * cgroup,int (* fn)(const char * cgroup,void * arg),void * arg) cg_run_nowait() argument
440 cg_run_nowait(const char * cgroup,int (* fn)(const char * cgroup,void * arg),void * arg) cg_run_nowait() argument
494 alloc_anon(const char * cgroup,void * arg) alloc_anon() argument
581 clone_into_cgroup_run_wait(const char * cgroup) clone_into_cgroup_run_wait() argument
606 __prepare_for_wait(const char * cgroup,const char * filename) __prepare_for_wait() argument
623 cg_prepare_for_wait(const char * cgroup) cg_prepare_for_wait() argument
628 memcg_prepare_for_wait(const char * cgroup) memcg_prepare_for_wait() argument
[all...]
/linux/kernel/bpf/
H A Dbpf_cgrp_storage.c41 struct cgroup *cg = owner; in cgroup_storage_ptr()
46 void bpf_cgrp_storage_free(struct cgroup *cgroup) in bpf_cgrp_storage_free() argument
51 local_storage = rcu_dereference(cgroup->bpf_cgrp_storage); in bpf_cgrp_storage_free()
64 cgroup_storage_lookup(struct cgroup *cgroup, struct bpf_map *map, bool cacheit_lockit) in cgroup_storage_lookup() argument
69 cgroup_storage = rcu_dereference_check(cgroup->bpf_cgrp_storage, in cgroup_storage_lookup()
81 struct cgroup *cgroup; in bpf_cgrp_storage_lookup_elem() local
85 cgroup = cgroup_v1v2_get_from_fd(fd); in bpf_cgrp_storage_lookup_elem()
86 if (IS_ERR(cgroup)) in bpf_cgrp_storage_lookup_elem()
87 return ERR_CAST(cgroup); in bpf_cgrp_storage_lookup_elem()
90 sdata = cgroup_storage_lookup(cgroup, map, true); in bpf_cgrp_storage_lookup_elem()
[all …]
H A Dcgroup_iter.c47 __bpf_md_ptr(struct cgroup *, cgroup);
130 if (css && cgroup_is_dead(css->cgroup)) in __cgroup_iter_seq_show()
134 ctx.cgroup = css ? css->cgroup : NULL; in __cgroup_iter_seq_show()
160 BTF_ID_LIST_GLOBAL_SINGLE(bpf_cgroup_btf_id, struct, cgroup) in BTF_ID_LIST_GLOBAL_SINGLE() argument
165 struct cgroup *cgrp = aux->cgroup.start; in BTF_ID_LIST_GLOBAL_SINGLE()
176 p->order = aux->cgroup.order; in BTF_ID_LIST_GLOBAL_SINGLE()
198 int fd = linfo->cgroup.cgroup_fd; in bpf_iter_attach_cgroup()
199 u64 id = linfo->cgroup.cgroup_id; in bpf_iter_attach_cgroup()
200 int order = linfo->cgroup.order; in bpf_iter_attach_cgroup()
201 struct cgroup *cgrp; in bpf_iter_attach_cgroup()
[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 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.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 …]
/linux/tools/perf/util/
H A Dcgroup.c4 #include "cgroup.h"
23 /* used to match cgroup name with patterns */
45 fprintf(stderr, "no access to cgroup %s\n", path); in open_cgroup()
66 int read_cgroup_id(struct cgroup *cgrp) in read_cgroup_id()
101 static struct cgroup *evlist__find_cgroup(struct evlist *evlist, const char *str) in evlist__find_cgroup()
117 struct cgroup *cgroup__new(const char *name, bool do_open) in cgroup__new()
119 struct cgroup *cgroup = zalloc(sizeof(*cgroup)); in cgroup__new() local
121 if (cgroup ! in cgroup__new()
148 struct cgroup *cgroup = evlist__find_cgroup(evlist, name); evlist__findnew_cgroup() local
179 cgroup__delete(struct cgroup * cgroup) cgroup__delete() argument
194 cgroup__get(struct cgroup * cgroup) cgroup__get() argument
201 evsel__set_default_cgroup(struct evsel * evsel,struct cgroup * cgroup) evsel__set_default_cgroup() argument
207 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);
34 void evlist__set_default_cgroup(struct evlist *evlist, struct cgroup *cgroup);
38 struct cgroup *cgroup__findnew(struct perf_env *env, uint64_t id,
40 struct cgroup *cgroup__find(struct perf_env *env, uint64_t id);
41 struct cgroup *__cgroup__find(struct rb_root *root, uint64_t id);
46 int read_cgroup_id(struct cgroup *cgrp);
[all …]
/linux/include/trace/events/
H A Dcgroup.h3 #define TRACE_SYSTEM cgroup
8 #include <linux/cgroup.h>
54 DECLARE_EVENT_CLASS(cgroup,
56 TP_PROTO(struct cgroup *cgrp, const char *path),
78 DEFINE_EVENT(cgroup, cgroup_mkdir,
80 TP_PROTO(struct cgroup *cgrp, const char *path),
85 DEFINE_EVENT(cgroup, cgroup_rmdir,
87 TP_PROTO(struct cgroup *cgrp, const char *path),
92 DEFINE_EVENT(cgroup, cgroup_release,
94 TP_PROTO(struct cgroup *cgr
[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 Dcgroups.rst6 Documentation/admin-guide/cgroup-v1/cpusets.rst
50 A *cgroup* associates a set of tasks with a set of parameters for one
56 schedules a resource or applies per-cgroup limits, but it may be
63 state attached to each cgroup in the hierarchy. Each hierarchy has
64 an instance of the cgroup virtual filesystem associated with it.
70 instance of the cgroup virtual file system, specify and query to
71 which cgroup a task is assigned, and list the task PIDs assigned to
72 a cgroup. Those creations and assignments only affect the hierarchy
73 associated with that instance of the cgroup file system.
77 cgroup support to provide new attributes for cgroups, such as
[all …]
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 Dfreezer-subsystem.rst5 The cgroup freezer is useful to batch job management system which start
9 whole. The cgroup freezer uses cgroups to describe the set of tasks to
13 The cgroup freezer will also be useful for checkpointing running groups
15 image of the tasks by attempting to force the tasks in a cgroup into a
51 In contrast, the cgroup freezer uses the kernel freezer code to
56 The cgroup freezer is hierarchical. Freezing a cgroup freezes all
57 tasks belonging to the cgroup and all its descendant cgroups. Each
58 cgroup has its own state (self-state) and the state inherited from the
59 parent (parent-state). Iff both states are THAWED, the cgroup is
62 The following cgroupfs files are created by cgroup freezer.
[all …]
H A Drdma.rst23 cgroup.
30 in other cgroup or kernel space ULPs may not even get chance to allocate any
40 RDMA cgroup allows limit configuration of resources. Rdma cgroup maintains
41 resource accounting per cgroup, per device using resource pool structure.
43 by rdma cgroup, which can be extended later if required.
45 This resource pool object is linked to the cgroup css. Typically there
46 are 0 to 4 resource pool instances per cgroup, per device in most use cases.
48 single cgroup may not be handled optimally, however there is no
53 always owned by the creator cgroup css. This allows process migration from one
54 to other cgroup without major complexity of transferring resource ownership;
[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 Dmemcg_test.rst13 (*) Topics on API should be in Documentation/admin-guide/cgroup-v1/memory.rst)
168 mount -t cgroup -o cpuset none /opt/cpuset
218 mkdir /opt/cgroup/01/child_a
219 mkdir /opt/cgroup/01/child_b
227 /opt/cgroup/01/child_a/child_aa
228 /opt/cgroup/01/child_b/child_bb
229 /opt/cgroup/01/child_c
237 race and lock dependency with other cgroup subsystems.
241 # mount -t cgroup none /cgroup -o cpuset,memory,cpu,devices
256 # mount -t cgroup none /cgroup -o memory
[all …]
/linux/kernel/cgroup/
H A Drstat.c15 static void cgroup_base_stat_flush(struct cgroup *cgrp, int cpu);
17 static struct cgroup_rstat_cpu *cgroup_rstat_cpu(struct cgroup *cgrp, int cpu) in cgroup_rstat_cpu()
32 struct cgroup *cgrp, const bool fast_path) in _cgroup_rstat_cpu_lock()
65 struct cgroup *cgrp, unsigned long flags, in _cgroup_rstat_cpu_unlock()
85 __bpf_kfunc void cgroup_rstat_updated(struct cgroup *cgrp, int cpu) in cgroup_rstat_updated()
106 struct cgroup *parent = cgroup_parent(cgrp); in cgroup_rstat_updated()
144 static struct cgroup *cgroup_rstat_push_children(struct cgroup *head, in cgroup_rstat_push_children()
145 struct cgroup *child, int cpu) in cgroup_rstat_push_children()
147 struct cgroup *chead = child; /* Head of child cgroup level */ in cgroup_rstat_push_children()
148 struct cgroup *ghead = NULL; /* Head of grandchild cgroup level */ in cgroup_rstat_push_children()
[all …]
H A Dcgroup-internal.h5 #include <linux/cgroup.h>
43 * The cgroup filesystem superblock creation/mount context.
89 * A cgroup can be associated with multiple css_sets as different tasks may
97 /* the cgroup and css_set this link associates */
98 struct cgroup *cgrp;
178 * for_each_subsys - iterate all enabled cgroup subsystems
186 static inline bool cgroup_is_dead(const struct cgroup *cgrp) in cgroup_is_dead()
191 static inline bool notify_on_release(const struct cgroup *cgrp) in notify_on_release()
224 bool cgroup_on_dfl(const struct cgroup *cgrp);
227 struct cgroup *task_cgroup_from_roo
[all...]
H A Dcgroup.c31 #include "cgroup-internal.h"
33 #include <linux/bpf-cgroup.h>
65 #include <trace/events/cgroup.h>
81 * cgroup_mutex is the master lock. Any modification to cgroup or its
88 * cgroup.h can use them for lockdep annotations.
122 * cgroup destruction makes heavy use of work items and there can be a lot
123 * of concurrent destructions. Use a separate workqueue so that cgroup
129 /* generate an array of cgroup subsystem pointers */
136 /* array of cgroup subsystem names */
212 /* cgroup namespac
3671 struct cgroup *cgroup = seq_css(seq)->cgroup; cgroup_stat_show() local
5723 struct cgroup *cgroup; cgroup_check_hierarchy_limits() local
6982 struct cgroup *cgroup; cgroup_sk_alloc() local
[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>`.
20 1-2. What is cgroup?
70 5.9-1 Miscellaneous cgroup Interface Files
75 5-N-1. CPU controller root cgroup process behaviour
76 5-N-2. IO controller root cgroup process behaviour
100 "cgroup" stands for "control group" and is never capitalized. The
102 qualifier as in "cgroup controllers". When explicitly referring to
106 What is cgroup?
[all …]
/linux/tools/perf/tests/shell/
H A 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} …
/linux/tools/testing/selftests/mm/
H A Dcharge_reserved_hugetlb.sh21 if [[ "$1" == "-cgroup-v2" ]]; then
32 cgroup_path=/dev/cgroup/memory
36 echo "+hugetlb" >$cgroup_path/cgroup.subtree_control
38 cgroup_path=$(mount -t cgroup | grep ",hugetlb" | awk '{print $3}')
40 cgroup_path=/dev/cgroup/memory
41 mount -t cgroup memory,hugetlb $cgroup_path
49 echo $$ >$cgroup_path/cgroup.procs
100 echo writing cgroup limit: "$cgroup_limit"
116 local cgroup="$1"
117 local path="$cgroup_path/$cgroup/hugetl
[all...]

1234567891011