about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2025-01-26 09:41:57 -0700
committerRalf Jung <post@ralfj.de>2025-01-26 09:41:57 -0700
commitd7f165690b5e7cc58ad8942bc82812cea84bec4c (patch)
tree86cbb0e5a4c46706b7e69441bf94ac461abacb8b /src
parent4ce50a3977483fd8287d47e19e62f4368e5a9183 (diff)
downloadrust-d7f165690b5e7cc58ad8942bc82812cea84bec4c.tar.gz
rust-d7f165690b5e7cc58ad8942bc82812cea84bec4c.zip
many-seeds: do not use more than 8 threads
Diffstat (limited to 'src')
-rw-r--r--src/tools/miri/src/bin/miri.rs7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/tools/miri/src/bin/miri.rs b/src/tools/miri/src/bin/miri.rs
index 97fcdddf93c..988a0be6327 100644
--- a/src/tools/miri/src/bin/miri.rs
+++ b/src/tools/miri/src/bin/miri.rs
@@ -723,10 +723,9 @@ fn main() {
 
     // Ensure we have parallelism for many-seeds mode.
     if many_seeds.is_some() && !rustc_args.iter().any(|arg| arg.starts_with("-Zthreads=")) {
-        rustc_args.push(format!(
-            "-Zthreads={}",
-            std::thread::available_parallelism().map_or(1, |n| n.get())
-        ));
+        // Clamp to 8 threads; things get a lot less efficient beyond that due to lock contention.
+        let threads = std::thread::available_parallelism().map_or(1, |n| n.get()).min(8);
+        rustc_args.push(format!("-Zthreads={threads}"));
     }
     let many_seeds =
         many_seeds.map(|seeds| ManySeedsConfig { seeds, keep_going: many_seeds_keep_going });