nproc: cgroup v2 quota ignored when the cgroup path contains ':' or the quota is on a parent cgroup
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 32/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- linux, rust
調査の方向性
Start from cgroups2_quota, which takes split(':').nth(2) of /proc/self/cgroup — a path containing a colon is truncated there, so cpu.max is never found. Fix the path extraction (split on the first two fields only), then walk from the leaf cgroup up through its ancestors reading each cpu.max and keep the smallest quota, as GNU does. Verify with the two systemd-run/systemctl --user set-property repros in the issue: the colon case must print 2 and the nested-quota case 1 on a 4-CPU box. Note a linked PR #16754 is already open, so coordinate before starting.
索引モデルが issue の本文から書いたものです。
説明
nproc misses cgroup v2 CPU quotas in two cases where GNU honors them.
1. The cgroup path contains a :
cgroups2_quota takes split(':').nth(2) of /proc/self/cgroup, so a path such as 0::/user.slice/.../app-dbus\x2d:1.3\x2dorg.gnome.Console.slice/vte-spawn-....scope (the default for a GNOME Console terminal) is cut at the colon, cpu.max is not found, and the quota is ignored.
$ systemd-run --user --scope -q --unit='nq:colon' -p CPUQuota=200% sh -c 'nproc; ./target/debug/nproc'
2 # GNU 9.11
4 # uutils
2. The quota is set on an ancestor cgroup
Only the process's own cpu.max is read. A quota on a parent slice also limits the process, and GNU uses the smallest quota along the path:
$ systemctl --user set-property --runtime nq.slice CPUQuota=150%
$ systemd-run --user --scope -q --slice=nq.slice sh -c 'nproc; ./target/debug/nproc'
2 # GNU
4 # uutils
$ systemctl --user set-property --runtime nq.slice CPUQuota=100%
$ systemd-run --user --scope -q --slice=nq.slice -p CPUQuota=300% sh -c 'nproc; ./target/debug/nproc'
1 # GNU
3 # uutils
(4 CPUs, cgroup v2, GNU coreutils 9.11.)
- 主要言語
- Rust
- スター
- 24.4k
- フォーク
- 2.2k
- 平均マージ
- 2日 23時間
- マージ済み PR(30日)
- 402
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
uutils/coreutils のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
split -n leaves bytes from a previous run in chunks that should be empty対応中かも @costajohnt が 2 日前に担当しました。 オープンU - split
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
dircolors: '=' is not escaped and '^'/'\\' do not toggle the backslash state, unlike GNU再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープンU - dircolors
難易度 2/5 1〜3時間 初心者へのやさしさ 63/100
メンテナーはふだん 1 日以内に返信
-
U - shred
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信
-
chown -v: `+ID` spec echoed verbatim on a broken symlink対応中かも @sunsss123soldier が 7 日前に担当しました。 オープンgood first issue oss-scanner U - chown
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
メンテナーはふだん 1 日以内に返信
uutils/coreutils の issue をすべて見る
似ている issue
-
marketing
難易度 2/5 半日 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
S: Untriaged T: Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
libnyanpasu/clash-nyanpasu#6537 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1時間未満 初心者へのやさしさ 62/100
tauri-apps/tao#1445 ·
メンテナーはふだん 1 日以内に返信
-
bug P3
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
-
go good first issue test
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 2 日以内に返信