Skip to content

Conversation

@panosmaurikos
Copy link
Contributor

@panosmaurikos panosmaurikos commented Jan 24, 2026

Implement cgroup v2 management for urunc containers using a split-policy
architecture that separates vCPU (workload) threads from I/O (overhead) threads.

Changes

  • Add pkg/cgroup/manager.go with Manager struct for cgroup lifecycle management
  • Add setupCgroups() in create.go to initialize cgroups during container creation
  • Add MoveToOverhead() call before exec in unikontainers.go (pre-move pattern)
  • Add MoveVCPUThreads() call after 200ms delay in start.go
  • Add cgroup configuration support in urunc_config.go
  • Add unit tests for cgroup manager functionality

How it works

The pre-move pattern ensures proper thread classification without a helper process:

  1. urunc create: Creates sandbox (with limits) and overhead (no limits) cgroups
  2. reexec: Moves itself to OVERHEAD cgroup before exec()
  3. exec(QEMU): QEMU inherits OVERHEAD cgroup, all threads spawn there
  4. urunc start: Waits 200ms, then moves only vCPU threads to SANDBOX

Final state: vCPU threads are in SANDBOX (with resource limits), while QEMU main
process and I/O threads remain in OVERHEAD (no limits).

panosmaurikos and others added 2 commits January 22, 2026 13:27
Implement cgroup v2 management for urunc containers using a split-policy
architecture that separates vCPU (workload) threads from I/O (overhead)
threads.

Key changes:
- Introduce pkg/cgroup/manager.go with a Manager handling cgroup lifecycle
- Initialize cgroups during container creation via setupCgroups() in create.go
- Move the runtime process to the overhead cgroup before exec
- Move vCPU threads to the workload cgroup after a 200ms delay in start.go
- Add cgroup configuration support in urunc_config.go
- Add unit tests for cgroup manager behavior

Signed-off-by: Panos Mavrikos <pmavrikos@nubificus.co.uk>
@netlify
Copy link

netlify bot commented Jan 24, 2026

Deploy Preview for urunc canceled.

Name Link
🔨 Latest commit e7d56de
🔍 Latest deploy log https://app.netlify.com/projects/urunc/deploys/697551037f806800084d9fa6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant