nestybox / nestybox/sysbox

bug: sysbox-runc does not copy cpu.cfs_{quota,period}_us to syscont-cgroup-root

Open
#582 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Shell
Stars
3.9k
Forks
230
Avg merge
7h 48m
Merged PRs (30d)
3

Description

bug: sysbox-runc does not copy cpu.cfs_{quota_period}_us to syscont-cgroup-root

Summary

Similar to https://github.com/nestybox/sysbox/issues/303 sysbox-runc is not copying the cgroup CPU quota and limit values from the parent cgroup to syscont-cgroup-root.
Processes running inside the container have no idea about how much CPU they have to work with.

Impact

Low. The container still gets limited, but the limit is opaque and not visible inside the container.

Steps to reproduce

Reproduced on sysbox-ce version 0.5.0 and version 0.5.2.

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.4 LTS
Release:        20.04
Codename:       focal

$ uname -a
Linux bigred 5.13.0-51-generic #58~20.04.1-Ubuntu SMP Tue Jun 14 11:29:12 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

$ docker info | grep Version
 Server Version: 20.10.17
 Cgroup Version: 1
 Kernel Version: 5.13.0-51-generic

# Docker's default runtime sets these values 
$ docker run -it --rm --memory=256M --cpu-quota=20000 --cpu-period=10000 alpine:latest
/ # cat /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_period_us
10000
/ # cat /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_quota_us
20000

# outside the container the limits are set on the cgroup
$ cat /sys/fs/cgroup/cpu,cpuacct/docker/9e50ac0b99b2510dfacee0205116d5f1c0dc2b5acddef2d25746fcfdc74a91c4/cpu.cfs_period_us
10000
$ cat /sys/fs/cgroup/cpu,cpuacct/docker/9e50ac0b99b2510dfacee0205116d5f1c0dc2b5acddef2d25746fcfdc74a91c4/cpu.cfs_quota_us
20000

# sysbox-runc runtime does not
$ docker run -it --rm --memory=256M --cpu-quota=20000 --cpu-period=10000 --runtime=sysbox-runc alpine:latest
/ # cat /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_quota_us
-1
/ # cat /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_period_us
100000
# outside the container the limits are set on the parent cgroup but not syscont-cgroup-root
$ cat /sys/fs/cgroup/cpu,cpuacct/docker/d3711f4abdbca7b0c016f373b7490d93dad6e042e9c5acfdd79ad272f12d37e1/cpu.cfs_period_us 
10000
$ cat /sys/fs/cgroup/cpu,cpuacct/docker/d3711f4abdbca7b0c016f373b7490d93dad6e042e9c5acfdd79ad272f12d37e1/cpu.cfs_quota_us 
20000

$ cat /sys/fs/cgroup/cpu,cpuacct/docker/d3711f4abdbca7b0c016f373b7490d93dad6e042e9c5acfdd79ad272f12d37e1/syscont-cgroup-root/cpu.cfs_period_us 
100000
$ cat /sys/fs/cgroup/cpu,cpuacct/docker/d3711f4abdbca7b0c016f373b7490d93dad6e042e9c5acfdd79ad272f12d37e1/syscont-cgroup-root/cpu.cfs_quota_us 
-1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing sysbox-runc's cgroup setup for syscont-cgroup-root and compare how the parent cgroup's CPU quota and period are handled. Reproduce the Docker commands from the issue, then verify that the container and syscont-cgroup-root expose the configured cpu.cfs_quota_us and cpu.cfs_period_us values.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, linux
Domain
devops, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.