Expand description
Cell manager for userspace-driven cell creation.
This module implements the --cell-parent-cgroup mode where cells are created
for direct child cgroups of a specified parent. Uses inotify to watch for
cgroup creation/destruction and manages cell ID allocation.
Re-exportsยง
use std::collections::BTreeMap;๐use std::collections::BTreeSet;๐use std::collections::HashMap;๐use std::collections::HashSet;๐use std::fs::DirEntry;๐use std::os::unix::fs::MetadataExt;๐use std::os::unix::io::AsFd;๐use std::os::unix::io::BorrowedFd;๐use std::path::Path;๐use std::path::PathBuf;๐use std::sync::atomic::AtomicBool;๐use std::sync::atomic::Ordering;๐use anyhow::Context;๐use anyhow::Result;๐use anyhow::bail;๐use inotify::Inotify;๐use inotify::WatchMask;๐use scx_utils::Cpumask;๐use tracing::debug;๐use tracing::info;๐
Structsยง
- Cell
Info - Information about a cell created for a cgroup
- Cell
Manager - Manages cells for direct child cgroups of a specified parent
- CpuAssignment
- Result of CPU assignment computation, containing both primary and optional borrowable masks.
- CpuManager ๐
- Generic CPU allocator over a fixed domain of CPUs.
- CpuMinimum ๐
- Minimum primary-CPU constraints for a partitioning recipient.
- CpuRecipient ๐
- Generic allocation input for a CPU partitioning recipient.
Functionsยง
- add_
cpus_ ๐to_ assignment - Add
cpusto recipientidโs mask inassignments. - assign_
partition_ ๐chunks - Place the per-recipient CPU
countsontodomainby partition chunk. The recipient with the most CPUs left takes the largest chunk that still fits, so each recipient collects whole partitions first; whatever counts remain are carved contiguously from the chunks nobody could take whole.countsmust sum to the domain size. - cgroup_
root_ ๐relative - Strip the cgroup mount prefix from a stored cell path, yielding the
root-relative cgroup path (e.g.
/sys/fs/cgroup/a/b->/a/b). - partition_
chunks ๐ - Group the CPUs of
domaininto chunks by partition (LLC), ordered by partition id. CPUs without a partition become one-CPU chunks at the end. - read_
dir_ ๐sorted