Advanced cgroups v2: Release Notification, Delegation, Thread Mode

Added:

Release Notifications
Notification Demo
Delegation Basics
Ownership Rules
Containment Rules
Delegation Demo
Thread Mode Intro
Hierarchy Types
Threaded Setup
CPU Allocation

Release Notifications

0:00
Playing Section
  • 1

    Cgroup release notifications signal when a cgroup becomes empty

  • 2

    Monitor cgroup.events files via inotify or poll to detect state changes

  • 3

    Useful for managing worker processes or respawning crashed daemons

Basic understanding of Linux control groups (cgroups v1 vs v2) and the unified hierarchy model.
Familiarity with the Linux process model, specifically the distinction between processes, threads, and thread groups.
Knowledge of how to navigate and manipulate virtual filesystems, particularly the '/sys/fs/cgroup' directory.
Understanding of Linux user privileges, file ownership, and Discretionary Access Control (DAC) mechanisms.
Designing and running rootless containers (e.g., using Podman or Docker in rootless mode) utilizing cgroups v2 delegation.
Implementing advanced systemd resource management using slices, scopes, and custom unit file configurations.
Monitoring and analyzing system resource pressure using Pressure Stall Information (PSI) combined with cgroups v2.
Developing custom userspace daemons or orchestrators in C, Go, or Rust to dynamically manage system resources via the cgroups v2 API.
5.6K views132likes1:01:50@NDCOriginal Release: 2021-11-03

Cgroups v2 introduces three advanced features: (1) Release notification uses cgroup.events files with a 'populated' key to detect when a cgroup becomes empty, enabling manager processes to know when workers have completed their tasks; (2) Delegation allows privileged users to pass ownership of cgroup subhierarchies to unprivileged users by changing directory and file ownership, enabling unprivileged container management while maintaining security through delegation containment rules that restrict process movement between containers; (3) Thread mode resolves the conflict between process-level granularity (default in v2) and thread-level granularity (possible in v1) by introducing threaded subtrees where threads of a multi-threaded process can be split across different cgroups within the subtree, with controllers classified as threaded (supporting thread-level granularity like CPU and PIDs controllers) or domain (only supporting process-level granularity like memory controller).