kernel/cgroup/cgroup-v1.c
Source file repositories/reference/linux-study-clean/kernel/cgroup/cgroup-v1.c
File Facts
- System
- Linux kernel
- Corpus path
kernel/cgroup/cgroup-v1.c- Extension
.c- Size
- 36795 bytes
- Lines
- 1373
- Domain
- Core OS
- Bucket
- Scheduler, Processes, Timers, Sync, And Syscalls
- Inferred role
- Core OS: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
cgroup-internal.hlinux/ctype.hlinux/kmod.hlinux/sort.hlinux/delay.hlinux/mm.hlinux/sched/signal.hlinux/sched/task.hlinux/magic.hlinux/slab.hlinux/string.hlinux/vmalloc.hlinux/delayacct.hlinux/pid_namespace.hlinux/cgroupstats.hlinux/fs_parser.htrace/events/cgroup.h
Detected Declarations
struct cgroup_pidlistenum cgroup_filetypeenum cgroup1_paramfunction cgroup1_ssid_disabledfunction cgroup1_subsys_absentfunction cgroup_attach_task_allfunction cgroup_post_forkfunction cgroup1_pidlist_destroy_allfunction cgroup_pidlist_destroy_work_fnfunction pidlist_uniqfunction cmppidfunction purposefunction pidlist_array_loadfunction startfunction cgroup_pidlist_stopfunction cgroup_pidlist_showfunction __cgroup1_procs_writefunction cgroup1_procs_writefunction cgroup1_tasks_writefunction cgroup_release_agent_writefunction cgroup_release_agent_showfunction cgroup_sane_behavior_showfunction cgroup_read_notify_on_releasefunction cgroup_write_notify_on_releasefunction cgroup_clone_children_readfunction cgroup_clone_children_writefunction proc_cgroupstats_showfunction for_each_subsysfunction cgroupstats_buildfunction cgroup1_check_for_releasefunction cgroupfunction cgroup1_renamefunction cgroup1_show_optionsfunction cgroup1_parse_paramfunction for_each_subsysfunction check_cgroupfs_optionsfunction cgroup1_reconfigurefunction cgroup1_root_to_usefunction for_each_rootfunction subsystemsfunction cgroup1_get_treefunction cgroup1_wq_initfunction cgroup_no_v1function for_each_subsysfunction cgroup_v1_procmodule init cgroup1_wq_initexport cgroup_attach_task_all
Annotated Snippet
core_initcall(cgroup1_wq_init);
static int __init cgroup_no_v1(char *str)
{
struct cgroup_subsys *ss;
char *token;
int i;
while ((token = strsep(&str, ",")) != NULL) {
if (!*token)
continue;
if (!strcmp(token, "all")) {
cgroup_no_v1_mask = U32_MAX;
continue;
}
if (!strcmp(token, "named")) {
cgroup_no_v1_named = true;
continue;
}
for_each_subsys(ss, i) {
if (strcmp(token, ss->name) &&
strcmp(token, ss->legacy_name))
continue;
cgroup_no_v1_mask |= 1 << i;
break;
}
}
return 1;
}
__setup("cgroup_no_v1=", cgroup_no_v1);
static int __init cgroup_v1_proc(char *str)
{
return (kstrtobool(str, &proc_show_all) == 0);
}
__setup("cgroup_v1_proc=", cgroup_v1_proc);
Annotation
- Immediate include surface: `cgroup-internal.h`, `linux/ctype.h`, `linux/kmod.h`, `linux/sort.h`, `linux/delay.h`, `linux/mm.h`, `linux/sched/signal.h`, `linux/sched/task.h`.
- Detected declarations: `struct cgroup_pidlist`, `enum cgroup_filetype`, `enum cgroup1_param`, `function cgroup1_ssid_disabled`, `function cgroup1_subsys_absent`, `function cgroup_attach_task_all`, `function cgroup_post_fork`, `function cgroup1_pidlist_destroy_all`, `function cgroup_pidlist_destroy_work_fn`, `function pidlist_uniq`.
- Atlas domain: Core OS / Scheduler, Processes, Timers, Sync, And Syscalls.
- Implementation status: integration 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.