summaryrefslogtreecommitdiffstats
path: root/tokio
diff options
context:
space:
mode:
authorSean McArthur <sean@seanmonstar.com>2020-04-09 12:42:46 -0700
committerGitHub <noreply@github.com>2020-04-09 12:42:46 -0700
commitd294c992e7236d5279d9e1a49b4536b21ccbc835 (patch)
tree5d88b7c4563dac7d949c4cc1bf31ecc99be2f522 /tokio
parent58ba45a38cc101e695895cc39d8ee4ce74176397 (diff)
Use logical CPUs instead of physical by default (#2391)
Some reasons to prefer logical count as the default: - Chips reporting many logical CPUs vs physical, such as via hyperthreading, probably know better than us about the workload the CPUs can handle. - The logical count (`num_cpus::get()`) takes into consideration schedular affinity, and cgroups CPU quota, in case the user wants to limit the amount of CPUs a process can use. Closes #2269
Diffstat (limited to 'tokio')
-rw-r--r--tokio/src/loom/std/mod.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/tokio/src/loom/std/mod.rs b/tokio/src/loom/std/mod.rs
index 28644544..595bdf60 100644
--- a/tokio/src/loom/std/mod.rs
+++ b/tokio/src/loom/std/mod.rs
@@ -75,7 +75,7 @@ pub(crate) mod sync {
pub(crate) mod sys {
#[cfg(feature = "rt-threaded")]
pub(crate) fn num_cpus() -> usize {
- usize::max(1, num_cpus::get_physical())
+ usize::max(1, num_cpus::get())
}
#[cfg(not(feature = "rt-threaded"))]