fix(developer-rust): defer CPU by nice and weight, drop the build semaphore - #91
Merged
Merged
Conversation
…aphore The governor was rationing CPU three ways at once and two of them were pure throughput loss: a 2-core reserve, then the core pool divided by a memory semaphore's slot count. On a 32-core box that settled on -j3. - builds now run at nice 19 inside rustbuild.slice, no core withheld, no job count set, cargo's own default is every core - the semaphore, the reserve, the lock wait, the degrade path and the job arithmetic are gone from the shim (411 -> 100 lines), and their five role variables fail the converge with a message rather than being ignored - the slice is renamed from rust-build.slice: the dash put it under an auto-created rust.slice where its CPUWeight faced no sibling, so the weight never reached the desktop. The old unit is removed at converge - the shim probes the user bus before the exec, so a stale /run/user falls back to plain nice instead of failing every cargo - hyperi-sccache.service carries Nice=19 as well as the slice, because compiles run inside the server and inherit nothing from cargo - macOS gets nice 19 too; taskpolicy and its QoS knob go - the shim gets its first tests: tools/tests/test_rust_govern.py Docs say what each instrument actually reaches: the weight binds against app.slice inside the user manager, not against another ssh session, and nice orders the build against whatever shares its cpu cgroup and nothing beyond. Supersedes #78: there are no slots left to weight. Closes #90
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.
The governor was protecting the host three ways at once and two of them were pure throughput loss. A 2-core reserve came off the top, then the memory semaphore divided what was left by the slots it would admit, and a 32-core box built at -j3. Yielding was the only one of the three we wanted.
What changes
rustbuild.slice. No core withheld, no job count set, cargo's default is every corerust-build.slice. The dash put it under an auto-createdrust.slicewhere its CPUWeight had no sibling to compete with, so the weight never reached the desktop -- checked on the cgroup tree here. The old unit is removed at converge/run/userin a container falls back to plain nice instead of failing every cargohyperi-sccache.servicegetsNice=19besideSlice=, because compiles run inside the server and inherit nothing from cargotaskpolicyand its QoS knob go -- one mechanism on every OStools/tests/test_rust_govern.py, ten cases on the no-bus path so they run anywhereWhat the docs now say honestly
app.sliceinside the user manager. It does NOT reach another ssh session (a sibling of the whole user manager). A weight onuser@UID.servicewould, and that is a system unit -- your call whether we want itNot done here
systemctl --user show rustbuild.slice -p CPUWeightreads 30, reset~/.config/rust-build-env.shand its.bashrcline -- the exports it carried are now the defaultsDone when a stock SOE Rust box builds at full core count and yields under contention, with no per-machine tuning and nothing for a second session to keep in sync.
Supersedes #78. Closes #90.