[tor-commits] [tor] branch main updated: thread: Bump max detectable CPU from 16 to 128

gitolite role git at cupani.torproject.org
Mon Oct 31 15:22:56 UTC 2022


This is an automated email from the git hooks/post-receive script.

dgoulet pushed a commit to branch main
in repository tor.

The following commit(s) were added to refs/heads/main by this push:
     new 5db238f3e3 thread: Bump max detectable CPU from 16 to 128
     new 65a85a9d23 Merge branch 'maint-0.4.7'
5db238f3e3 is described below

commit 5db238f3e3df54b11cf376d57d2cd89257b594f8
Author: David Goulet <dgoulet at torproject.org>
AuthorDate: Fri Oct 28 11:13:46 2022 -0400

    thread: Bump max detectable CPU from 16 to 128
    
    Lets take advantage of those beefy machines ;).
    
    Closes #40703
    
    Signed-off-by: David Goulet <dgoulet at torproject.org>
---
 changes/ticket40703      | 4 ++++
 src/lib/thread/numcpus.c | 6 +++++-
 src/test/test_util.c     | 2 +-
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/changes/ticket40703 b/changes/ticket40703
new file mode 100644
index 0000000000..f005f8f851
--- /dev/null
+++ b/changes/ticket40703
@@ -0,0 +1,4 @@
+  o Minor feature (performance):
+    - Bump the maximum amount of CPU to use from 16 to 128. Note that NumCPUs
+      torrc option overrides this hardcoded maximum. Fixes bug 40703; bugfix on
+      0.3.5.1-alpha.
diff --git a/src/lib/thread/numcpus.c b/src/lib/thread/numcpus.c
index 2c2589fdfe..e0ddb69931 100644
--- a/src/lib/thread/numcpus.c
+++ b/src/lib/thread/numcpus.c
@@ -70,7 +70,11 @@ compute_num_cpus_impl(void)
 #endif /* defined(_WIN32) || ... */
 }
 
-#define MAX_DETECTABLE_CPUS 16
+/** This is an arbitrary number but at this point in time, it is not that
+ * uncommon to see servers up to that amount of CPUs. Most servers will likely
+ * be around 16 to 32 cores now. Lets take advantage of large machines! The
+ * "NumCPUs" torrc option overrides this maximum. */
+#define MAX_DETECTABLE_CPUS 128
 
 /** Return how many CPUs we are running with.  We assume that nobody is
  * using hot-swappable CPUs, so we don't recompute this after the first
diff --git a/src/test/test_util.c b/src/test/test_util.c
index aa38d0fc5d..1dae2c617e 100644
--- a/src/test/test_util.c
+++ b/src/test/test_util.c
@@ -4987,7 +4987,7 @@ test_util_num_cpus(void *arg)
     tt_skip();
 
   tt_int_op(num, OP_GE, 1);
-  tt_int_op(num, OP_LE, 16);
+  tt_int_op(num, OP_LE, 128);
 
  done:
   ;

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the tor-commits mailing list