Repository navigation
nproc: honor cgroup v2 quotas on ancestors and paths with ':' - #16754
Open
Srizdebnath wants to merge 1 commit into
Open
Srizdebnath wants to merge 1 commit into
Srizdebnath wants to merge 1 commit into
Conversation
Read the cgroup v2 path from the "0::" line of /proc/self/cgroup instead of splitting on every ':', and take the smallest cpu.max quota from the process's cgroup up to the root, like GNU. Fixes uutils#16753
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #16753.
cgroups2_quotahad two gaps compared with GNU:split(':').nth(2)of/proc/self/cgroup, which cuts a path containing:(the default GNOME Console scope,app-dbus\x2d:1.3\x2d...). It now uses everything after the0::prefix.cpu.max. It now walks up to/sys/fs/cgroupand takes the smallest quota, skipping levels with nocpu.maxor amaxquota. Rounding per level is unchanged.The parsing and the walk take the file reader as a closure so they have unit tests without a real cgroup tree. Checked against GNU 9.11 with
systemd-run --user:nq:colon, CPUQuota=200%cargo test -p uu_nproc,test_nproc, fmt and clippy pass.