include/linux/cgroup-defs.h

Source file repositories/reference/linux-study-clean/include/linux/cgroup-defs.h

File Facts

System
Linux kernel
Corpus path
include/linux/cgroup-defs.h
Extension
.h
Size
29847 bytes
Lines
983
Domain
Core OS
Bucket
Core Kernel Interface
Inferred role
Core OS: implementation source
Status
source implementation candidate

Why This File Exists

Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.

Dependency Surface

Detected Declarations

Annotated Snippet

struct cgroup_file {
	/* do not access any fields from outside cgroup core */
	struct kernfs_node *kn;
	unsigned long notified_at;
	struct timer_list notify_timer;
	spinlock_t lock;
};

/*
 * Per-subsystem/per-cgroup state maintained by the system.  This is the
 * fundamental structural building block that controllers deal with.
 *
 * Fields marked with "PI:" are public and immutable and may be accessed
 * directly without synchronization.
 */
struct cgroup_subsys_state {
	/* PI: the cgroup that this css is attached to */
	struct cgroup *cgroup;

	/* PI: the cgroup subsystem that this css is attached to */
	struct cgroup_subsys *ss;

	/* reference count - access via css_[try]get() and css_put() */
	struct percpu_ref refcnt;

	/*
	 * Depending on the context, this field is initialized
	 * via css_rstat_init() at different places:
	 *
	 * when css is associated with cgroup::self
	 *   when css->cgroup is the root cgroup
	 *     performed in cgroup_init()
	 *   when css->cgroup is not the root cgroup
	 *     performed in cgroup_create()
	 * when css is associated with a subsystem
	 *   when css->cgroup is the root cgroup
	 *     performed in cgroup_init_subsys() in the non-early path
	 *   when css->cgroup is not the root cgroup
	 *     performed in css_create()
	 */
	struct css_rstat_cpu __percpu *rstat_cpu;

	/*
	 * siblings list anchored at the parent's ->children
	 *
	 * linkage is protected by cgroup_mutex or RCU
	 */
	struct list_head sibling;
	struct list_head children;

	/*
	 * PI: Subsys-unique ID.  0 is unused and root is always 1.  The
	 * matching css can be looked up using css_from_id().
	 */
	int id;

	unsigned int flags;

	/*
	 * Monotonically increasing unique serial number which defines a
	 * uniform order among all csses.  It's guaranteed that all
	 * ->children lists are in the ascending order of ->serial_nr and
	 * used to allow interrupting and resuming iterations.
	 */
	u64 serial_nr;

	/*
	 * Incremented by online self and children.  Used to guarantee that
	 * parents are not offlined before their children.
	 */
	atomic_t online_cnt;

	/* percpu_ref killing and RCU release */
	struct work_struct destroy_work;
	struct rcu_work destroy_rwork;

	/*
	 * PI: the parent css.	Placed here for cache proximity to following
	 * fields of the containing structure.
	 */
	struct cgroup_subsys_state *parent;

	/*
	 * Keep track of total numbers of visible descendant CSSes.
	 * The total number of dying CSSes is tracked in
	 * css->cgroup->nr_dying_subsys[ssid].
	 * Protected by cgroup_mutex.
	 */
	int nr_descendants;

Annotation

Implementation Notes