| /linux/tools/testing/selftests/cgroup/ |
| H A D | test_freezer.c | 27 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 D | test_kill.c | 21 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 D | cgroup_util.h | |
| H A D | cgroup_util.c | |
| /linux/tools/testing/selftests/cgroup/lib/ |
| H A D | cgroup_util.c | 77 char *cg_control(const char *cgroup, const char *control) in cg_control() argument 79 size_t len = strlen(cgroup) + strlen(control) + 2; in cg_control() 82 snprintf(ret, len, "%s/%s", cgroup, control); in cg_control() 88 int cg_read(const char *cgroup, const char *control, char *buf, size_t len) in cg_read() argument 93 snprintf(path, sizeof(path), "%s/%s", cgroup, control); in cg_read() 99 int cg_read_strcmp(const char *cgroup, const char *control, in cg_read_strcmp() argument 116 if (cg_read(cgroup, control, buf, size)) { in cg_read_strcmp() 126 int cg_read_strstr(const char *cgroup, const char *control, const char *needle) in cg_read_strstr() argument 130 if (cg_read(cgroup, control, buf, sizeof(buf))) in cg_read_strstr() 136 long cg_read_long(const char *cgroup, const char *control) in cg_read_long() argument [all …]
|
| /linux/tools/testing/selftests/cgroup/lib/include/ |
| H A D | cgroup_util.h | 55 extern char *cg_control(const char *cgroup, const char *control); 56 extern int cg_create(const char *cgroup); 57 extern int cg_destroy(const char *cgroup); 58 extern int cg_read(const char *cgroup, const char *control, 60 extern int cg_read_strcmp(const char *cgroup, const char *control, 62 extern int cg_read_strstr(const char *cgroup, const char *control, 64 extern long cg_read_long(const char *cgroup, const char *control); 66 long cg_read_key_long(const char *cgroup, const char *control, const char *key); 67 extern long cg_read_lc(const char *cgroup, const char *control); 68 extern int cg_write(const char *cgroup, const char *control, char *buf); [all …]
|
| /linux/tools/testing/selftests/bpf/progs/ |
| H A D | cgrp_kfunc_failure.c | 20 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 D | cgroup_read_xattr.c | 15 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 D | cgrp_kfunc_common.h | 13 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 D | cgrp_kfunc_success.c | 17 * 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...] |
| /linux/include/linux/ |
| H A D | cgroup.h | 108 struct cgroup_subsys_state *cgroup_e_css(struct cgroup *cgroup, 110 struct cgroup_subsys_state *cgroup_get_e_css(struct cgroup *cgroup, 115 struct cgroup *cgroup_get_from_path(const char *path); 116 struct cgroup *cgroup_get_from_fd(int fd); 117 struct cgroup *cgroup_v1v2_get_from_fd(int fd); 120 int cgroup_transfer_tasks(struct cgroup *to, struct cgroup *from); 334 static inline u64 cgroup_id(const struct cgroup *cgrp) in cgroup_id() 366 if (css == &css->cgroup->self) { in css_is_self() 375 static inline void cgroup_get(struct cgroup *cgrp) in cgroup_get() 380 static inline bool cgroup_tryget(struct cgroup *cgrp) in cgroup_tryget() [all …]
|
| /linux/tools/perf/util/ |
| H A D | cgroup.c | 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 != NULL) { in cgroup__new() 123 refcount_set(&cgroup->refcnt, 1); in cgroup__new() 125 cgroup->name = strdup(name); in cgroup__new() 126 if (!cgroup->name) in cgroup__new() 130 cgroup->fd = open_cgroup(name); in cgroup__new() 131 if (cgroup->fd == -1) in cgroup__new() [all …]
|
| H A D | cgroup.h | 12 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 D | bpftool-cgroup.rst | 4 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 D | cgroups.rst | 6 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 D | pids.rst | 8 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 D | rdma.rst | 23 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 D | net_cls.rst | 2 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 D | memcg_test.rst | 13 (*) 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 …]
|
| H A D | cpuacct.rst | 12 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 …]
|
| /linux/kernel/bpf/ |
| H A D | cgroup_iter.c | 47 __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/Documentation/admin-guide/ |
| H A D | cgroup-v2.rst | 11 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 D | cgroup.c | 279 static int cgroup_apply_control(struct cgroup *cgrp); 280 static void cgroup_finalize_control(struct cgroup *cgrp, int ret); 283 static int cgroup_destroy_locked(struct cgroup *cgrp); 284 static struct cgroup_subsys_state *css_create(struct cgroup *cgrp, 289 struct cgroup *cgrp, struct cftype cfts[], 358 bool cgroup_on_dfl(const struct cgroup *cgrp) in cgroup_on_dfl() 394 static bool cgroup_has_tasks(struct cgroup *cgrp) in cgroup_has_tasks() 399 static bool cgroup_is_threaded(struct cgroup *cgrp) in cgroup_is_threaded() 405 static bool cgroup_is_mixable(struct cgroup *cgrp) in cgroup_is_mixable() 416 static bool cgroup_can_be_thread_root(struct cgroup *cgrp) in cgroup_can_be_thread_root() [all …]
|
| H A D | cgroup-internal.h | 98 struct cgroup *cgrp; 187 static inline bool cgroup_is_dead(const struct cgroup *cgrp) in cgroup_is_dead() 192 static inline bool notify_on_release(const struct cgroup *cgrp) in notify_on_release() 225 bool cgroup_on_dfl(const struct cgroup *cgrp); 228 struct cgroup *task_cgroup_from_root(struct task_struct *task, 230 struct cgroup *cgroup_kn_lock_live(struct kernfs_node *kn, bool drain_offline); 232 int cgroup_path_ns_locked(struct cgroup *cgrp, char *buf, size_t buflen, 242 int cgroup_migrate_vet_dst(struct cgroup *dst_cgrp); 244 void cgroup_migrate_add_src(struct css_set *src_cset, struct cgroup *dst_cgrp, 250 int cgroup_attach_task(struct cgroup *dst_cgrp, struct task_struct *leader, [all …]
|
| H A D | freezer.c | 15 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 …]
|