diff options
| author | bors <bors@rust-lang.org> | 2022-06-09 18:20:08 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-06-09 18:20:08 +0000 |
| commit | 420c970cb1edccbf60ff2aeb51ca01e2300b09ef (patch) | |
| tree | 5863ed47015b553bfecba9f524318a64b64c9f94 /src/tools | |
| parent | d7b8d77be5b4a091fe99c2f32b1334b931a2f4aa (diff) | |
| parent | fbc86e07a94490fd23b9ef0fdd0f9118c50e5780 (diff) | |
| download | rust-420c970cb1edccbf60ff2aeb51ca01e2300b09ef.tar.gz rust-420c970cb1edccbf60ff2aeb51ca01e2300b09ef.zip | |
Auto merge of #97911 - dtolnay:numcpu, r=Mark-Simulacrum
Revert "remove num_cpus dependency" in rustc and update cargo Fixes #97549. This PR reverts #94524 and does a Cargo update to pull in rust-lang/cargo#10737. Rust 1.61.0 has a regression in which it misidentifies the number of available CPUs in some environments, leading to enormously increased memory usage and failing builds. In between Rust 1.60 and 1.61 both rustc and cargo replaced some uses of `num_cpus` with `available_parallelism`, which eliminated support for cgroupv1, still apparently in common use. This PR switches both rustc and cargo back to using `num_cpus` in order to support environments where the available parallelism is controlled by cgroupv1. Both can use `available_parallism` again once it handles cgroupv1 (if ever). I have confirmed that the rustc part of this PR fixes the memory usage regression in my non-Cargo environment, and others have confirmed in #97549 that the Cargo regression was at fault for the memory usage regression in their environments.
Diffstat (limited to 'src/tools')
| -rw-r--r-- | src/tools/build-manifest/Cargo.toml | 1 | ||||
| -rw-r--r-- | src/tools/build-manifest/src/main.rs | 2 | ||||
| m--------- | src/tools/cargo | 0 |
3 files changed, 2 insertions, 1 deletions
diff --git a/src/tools/build-manifest/Cargo.toml b/src/tools/build-manifest/Cargo.toml index c437bde5ae6..c022d3aa0ac 100644 --- a/src/tools/build-manifest/Cargo.toml +++ b/src/tools/build-manifest/Cargo.toml @@ -13,3 +13,4 @@ tar = "0.4.29" sha2 = "0.10.1" rayon = "1.5.1" hex = "0.4.2" +num_cpus = "1.13.0" diff --git a/src/tools/build-manifest/src/main.rs b/src/tools/build-manifest/src/main.rs index a1dfbef0601..6338e467055 100644 --- a/src/tools/build-manifest/src/main.rs +++ b/src/tools/build-manifest/src/main.rs @@ -210,7 +210,7 @@ fn main() { let num_threads = if let Some(num) = env::var_os("BUILD_MANIFEST_NUM_THREADS") { num.to_str().unwrap().parse().expect("invalid number for BUILD_MANIFEST_NUM_THREADS") } else { - std::thread::available_parallelism().map_or(1, std::num::NonZeroUsize::get) + num_cpus::get() }; rayon::ThreadPoolBuilder::new() .num_threads(num_threads) diff --git a/src/tools/cargo b/src/tools/cargo -Subproject 85e457e158db216a2938d51bc3b617a5a7fe601 +Subproject 4d92f07f34ba7fb7d7f207564942508f46c225d |
