Skip to content

Commit

Permalink
Merge branch 'reduce-lock-contention' of github.com:wathenjiang/tokio…
Browse files Browse the repository at this point in the history
… into reduce-lock-contention
  • Loading branch information
wathenjiang committed Sep 27, 2023
2 parents d0fab8e + a30df11 commit 6510d3e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tokio/src/runtime/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1284,6 +1284,11 @@ cfg_rt_multi_thread! {
use crate::runtime::scheduler::{self, MultiThread};

let core_threads = self.worker_threads.unwrap_or_else(num_cpus);
// Shrink the size of spawn_concurrency_level when using loom. This shouldn't impact
// logic, but allows loom to test more edge cases in a reasoable a mount of time
#[cfg(loom)]
let spawn_concurrency_level = 4;
#[cfg(not(loom))]
let spawn_concurrency_level = self.spawn_concurrency_level.unwrap_or(core_threads * 4);

let (driver, driver_handle) = driver::Driver::new(self.get_cfg())?;
Expand Down Expand Up @@ -1334,6 +1339,12 @@ cfg_rt_multi_thread! {
use crate::runtime::scheduler::MultiThreadAlt;

let core_threads = self.worker_threads.unwrap_or_else(num_cpus);

// Shrink the size of spawn_concurrency_level when using loom. This shouldn't impact
// logic, but allows loom to test more edge cases in a reasoable a mount of time
#[cfg(loom)]
let spawn_concurrency_level = 4;
#[cfg(not(loom))]
let spawn_concurrency_level = self.spawn_concurrency_level.unwrap_or(core_threads * 4);

let (driver, driver_handle) = driver::Driver::new(self.get_cfg())?;
Expand Down

0 comments on commit 6510d3e

Please sign in to comment.