Skip to main content

Module cell_manager

Module cell_manager 

Source
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ยง

CellInfo
Information about a cell created for a cgroup
CellManager
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 cpus to recipient idโ€™s mask in assignments.
assign_partition_chunks ๐Ÿ”’
Place the per-recipient CPU counts onto domain by 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. counts must 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 domain into chunks by partition (LLC), ordered by partition id. CPUs without a partition become one-CPU chunks at the end.
read_dir_sorted ๐Ÿ”’