Lines Matching +full:subsystem +full:- +full:level
1 /* SPDX-License-Identifier: GPL-2.0 */
8 * Copyright (C) 2004-2006 Silicon Graphics, Inc.
28 #include <linux/cgroup-defs.h>
66 struct list_head iters_node; /* css_set->task_iters */
85 * cgroup_subsys_enabled - fast test on whether a subsys is enabled
86 * @ss: subsystem in question
92 * cgroup_subsys_on_dfl - fast test on whether a subsys is on default hierarchy
93 * @ss: subsystem in question
164 * css_for_each_child - iterate through children of a css
170 * If a subsystem synchronizes ->css_online() and the start of iteration, a
171 * css which finished ->css_online() is guaranteed to be visible in the
173 * A css which hasn't finished ->css_online() or already finished
174 * ->css_offline() may show up during traversal. It's each subsystem's
186 * css_for_each_descendant_pre - pre-order walk of a css's descendants
193 * If a subsystem synchronizes ->css_online() and the start of iteration, a
194 * css which finished ->css_online() is guaranteed to be visible in the
196 * A css which hasn't finished ->css_online() or already finished
197 * ->css_offline() may show up during traversal. It's each subsystem's
223 * enclosed inside @pos locking, double-locking the parent isn't necessary
231 * iteration should lock and unlock both @pos->parent and @pos.
233 * Alternatively, a subsystem may choose to use a single global lock to
234 * synchronize ->css_online() and ->css_offline() against tree-walking
246 * css_for_each_descendant_post - post-order walk of a css's descendants
250 * Similar to css_for_each_descendant_pre() but performs post-order
254 * If a subsystem synchronizes ->css_online() and the start of iteration, a
255 * css which finished ->css_online() is guaranteed to be visible in the
257 * A css which hasn't finished ->css_online() or already finished
258 * ->css_offline() may show up during traversal. It's each subsystem's
261 * Note that the walk visibility guarantee example described in pre-order
262 * walk doesn't apply the same to post-order walks.
269 * cgroup_taskset_for_each - iterate cgroup_taskset
292 * cgroup_taskset_for_each_leader - iterate group leaders in a cgroup_taskset
297 * Iterate threadgroup leaders of @tset. For single-task migrations, @tset
304 if ((leader) != (leader)->group_leader) \
327 return cgrp->kn->id; in cgroup_id()
331 * css_is_dying - test whether the specified css is dying
335 * most cases, ->css_online() and ->css_offline() callbacks should be
347 return css->flags & CSS_DYING; in css_is_dying()
352 css_get(&cgrp->self); in cgroup_get()
357 return css_tryget(&cgrp->self); in cgroup_tryget()
362 css_put(&cgrp->self); in cgroup_put()
378 * task_css_set_check - obtain a task's css_set with extra access conditions
392 rcu_dereference_check((task)->cgroups, \
396 ((task)->flags & PF_EXITING) || (__c))
399 rcu_dereference((task)->cgroups)
403 * task_css_check - obtain css for (task, subsys) w/ extra access conds
405 * @subsys_id: the target subsystem ID
412 task_css_set_check((task), (__c))->subsys[(subsys_id)]
415 * task_css_set - obtain a task's css_set
426 * task_css - obtain css for (task, subsys)
428 * @subsys_id: the target subsystem ID
439 * task_get_css - find and get the css for (task, subsys)
441 * @subsys_id: the target subsystem ID
470 * task_css_is_root - test whether a task belongs to the root css
472 * @subsys_id: the target subsystem ID
474 * Test whether @task belongs to the root css on the specified subsystem.
486 return task_css(task, subsys_id)->cgroup; in task_cgroup()
491 return task_css_set(task)->dfl_cgrp; in task_dfl_cgroup()
496 struct cgroup_subsys_state *parent_css = cgrp->self.parent; in cgroup_parent()
504 * cgroup_is_descendant - test ancestry
515 if (cgrp->root != ancestor->root || cgrp->level < ancestor->level) in cgroup_is_descendant()
517 return cgrp->ancestors[ancestor->level] == ancestor; in cgroup_is_descendant()
521 * cgroup_ancestor - find ancestor of cgroup
523 * @ancestor_level: level of ancestor to find starting from root
525 * Find ancestor of cgroup at specified level starting from root if it exists
534 if (ancestor_level < 0 || ancestor_level > cgrp->level) in cgroup_ancestor()
536 return cgrp->ancestors[ancestor_level]; in cgroup_ancestor()
540 * task_under_cgroup_hierarchy - test task's membership of cgroup ancestry
553 return cgroup_is_descendant(cset->dfl_cgrp, ancestor); in task_under_cgroup_hierarchy()
559 return cgrp->nr_populated_csets + cgrp->nr_populated_domain_children + in cgroup_is_populated()
560 cgrp->nr_populated_threaded_children; in cgroup_is_populated()
566 return kernfs_ino(cgrp->kn); in cgroup_ino()
569 /* cft/css accessors for cftype->write() operation */
572 return of->kn->priv; in of_cft()
577 /* cft/css accessors for cftype->seq_*() operations */
580 return of_cft(seq->private); in seq_cft()
585 return of_css(seq->private); in seq_css()
595 return kernfs_name(cgrp->kn, buf, buflen); in cgroup_name()
600 return kernfs_path(cgrp->kn, buf, buflen); in cgroup_path()
605 pr_cont_kernfs_name(cgrp->kn); in pr_cont_cgroup_name()
610 pr_cont_kernfs_path(cgrp->kn); in pr_cont_cgroup_path()
622 current->no_cgroup_migration = 1; in cgroup_init_kthreadd()
631 current->no_cgroup_migration = 0; in cgroup_kthread_ready()
649 struct dentry *dentry) { return -EINVAL; } in cgroupstats_build()
746 * sock->sk_cgrp_data handling. For more info, see sock_cgroup_data
747 * definition in cgroup-defs.h.
757 return skcd->cgroup; in sock_cgroup_ptr()
803 refcount_inc(&ns->ns.count); in get_cgroup_ns()
808 if (ns && refcount_dec_and_test(&ns->ns.count)) in put_cgroup_ns()
823 return task->frozen; in cgroup_task_frozen()
840 percpu_ref_get(&cgrp->bpf.refcnt); in cgroup_bpf_get()
845 percpu_ref_put(&cgrp->bpf.refcnt); in cgroup_bpf_put()