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.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/limits.hlinux/list.hlinux/idr.hlinux/wait.hlinux/mutex.hlinux/rcupdate.hlinux/refcount.hlinux/percpu-refcount.hlinux/percpu-rwsem.hlinux/sched.hlinux/u64_stats_sync.hlinux/workqueue.hlinux/bpf-cgroup-defs.hlinux/psi_types.hlinux/cgroup_subsys.h
Detected Declarations
struct cgroupstruct cgroup_rootstruct cgroup_subsysstruct cgroup_tasksetstruct kernfs_nodestruct kernfs_opsstruct kernfs_open_filestruct seq_filestruct poll_table_structstruct cgroup_filestruct cgroup_subsys_statestruct css_setstruct cgroup_base_statstruct css_rstat_cpustruct cgroup_rstat_base_cpustruct cgroup_freezer_statestruct cgroupstruct cgroup_rootstruct cftypestruct cgroup_subsysstruct cgroup_of_peakstruct sock_cgroup_datastruct sock_cgroup_dataenum cgroup_subsys_idenum cgroup_attach_lock_modefunction cgroup_threadgroup_change_beginfunction cgroup_threadcgroup_change_beginfunction cgroup_threadgroup_change_beginfunction cgroup_threadgroup_change_endfunction sock_cgroup_prioidxfunction sock_cgroup_classidfunction sock_cgroup_set_prioidxfunction sock_cgroup_set_classid
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
- Immediate include surface: `linux/limits.h`, `linux/list.h`, `linux/idr.h`, `linux/wait.h`, `linux/mutex.h`, `linux/rcupdate.h`, `linux/refcount.h`, `linux/percpu-refcount.h`.
- Detected declarations: `struct cgroup`, `struct cgroup_root`, `struct cgroup_subsys`, `struct cgroup_taskset`, `struct kernfs_node`, `struct kernfs_ops`, `struct kernfs_open_file`, `struct seq_file`, `struct poll_table_struct`, `struct cgroup_file`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.