Repository navigation
fix(mutants): split test threads between parallel jobs - #574
Merged
Merged
Conversation
cargo-mutants' jobserver shares the CPUs between parallel jobs' builds, but each job's nextest still ran one test per CPU, so `-j 8` ran up to eight times as many test threads as the host has CPUs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # admin/mutants
kixelated
marked this pull request as ready for review
November 11, 2026 10:05
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 53 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
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.
Problem:
admin/mutants -j Noversubscribes the host. cargo-mutants 27.1's jobserver (on by default) caps the builds of all parallel jobs at the CPU count, but not their tests: each job's nextest runsnproctest threads. On a 24-core desktop, an-j 8armv7 run alongside an-j 3x86_64 run pushed the 1-minute load average to 95-107, with 63% CPU pressure stall.Approach:
admin/mutantsreads the job count (-j N,-jN,--jobs N,--jobs=N, orCARGO_MUTANTS_JOBS, stopping at--) and setsNEXTEST_TEST_THREADStoceil(nproc / jobs). cargo-mutants never passes--test-threadsitself, so the variable reaches each job's nextest. A single-job run, asmutants.ymldoes, keepsnprocthreads.Impact: no public API change.
Alternatives: cargo-mutants'
--jobserver-taskslimits only its own children's build tasks; nextest does not take jobserver tokens, so it cannot bound tests.Decisions
--avx512runner line): kept both, the threads block and main's${avx512:+--avx512 }--runrunner.--target Xoff before the job parsing, as--avx512and--survivorsare, so the loop sees only cargo-mutants' arguments. Under qemu each test thread is one qemu-arm process, soceil(nproc / jobs)still bounds the processes. The threads logic needs no change there.Validation: the argument parsing gives 24 / 3 / 3 / 8 / 8 / 6 threads for no
-j,-j 8,-j8,--jobs 3,--jobs=3, and--re x -j 4 -- -j 2on 24 CPUs. After the merge,shellcheck admin/mutantsandjust check(throughquest gate) pass. Not measured end to end under a real-j 8campaign.Models
Size: XS
Implementer: Claude Code, claude-opus-5-5, low effort (iterate, XS)
🤖 Generated with Claude Code
(Written by Claude Opus 5.5 with low)
Review
Rewritten by
quest reviewafter each round.01a1ca11-3cd6-7cf0-bc19-60d0aed88d30, round 1The change is narrowly scoped and consistent with the existing runner, with no actionable correctness or security issues found by inspection, though execution checks were excluded as instructed.