From d294c992e7236d5279d9e1a49b4536b21ccbc835 Mon Sep 17 00:00:00 2001
From: Sean McArthur <sean@seanmonstar.com>
Date: Thu, 9 Apr 2020 12:42:46 -0700
Subject: [PATCH] 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
---
 tokio/src/loom/std/mod.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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"))]
-- 
GitLab