[PATCH] D115019: ThreadPool: grow the pool only as needed

Benoit Jacob via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 2 19:05:46 PST 2021


Benoit added inline comments.


================
Comment at: llvm/lib/Support/ThreadPool.cpp:24
+void ThreadPool::grow() {
+  if (getThreadCount() >= Strategy.compute_thread_count()) {
+    // Already hit the max thread pool size.
----------------
Here actually I'm really not sure: what should be the max number of threads in `Threads`:  should it be `Strategy.compute_thread_count()` or should it be that minus one to account for the main thread?  it looks like the existing code was doing the former but (as actually confirmed by GDB) that meant it had one more thread running than the detected hardware concurrency.  Which could be fine if we expect that the main thread would be idle most of the time? What was the intent here?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115019/new/

https://reviews.llvm.org/D115019



More information about the llvm-commits mailing list