mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 02:14:43 +00:00
Bug 1713287 - Change the number of threads TaskController creates to match those required by the JS engine r=bas
Currently parallel Wasm compilation requires at least two threads for architectural reasons. This patch updates the TaskController thread policy such that there are always two threads available, even on single core systems. Differential Revision: https://phabricator.services.mozilla.com/D117002
This commit is contained in:
parent
75b4aba015
commit
50c5254a22
@ -40,6 +40,7 @@ std::unique_ptr<TaskController> TaskController::sSingleton;
|
||||
thread_local size_t mThreadPoolIndex = -1;
|
||||
std::atomic<uint64_t> Task::sCurrentTaskSeqNo = 0;
|
||||
|
||||
const int32_t kMinimumPoolThreadCount = 2;
|
||||
const int32_t kMaximumPoolThreadCount = 8;
|
||||
|
||||
/* static */
|
||||
@ -50,13 +51,8 @@ int32_t TaskController::GetPoolThreadCount() {
|
||||
|
||||
int32_t numCores = std::max<int32_t>(1, PR_GetNumberOfProcessors());
|
||||
|
||||
if (numCores == 1) {
|
||||
return 1;
|
||||
}
|
||||
if (numCores == 2) {
|
||||
return 2;
|
||||
}
|
||||
return std::min<int32_t>(kMaximumPoolThreadCount, numCores - 1);
|
||||
return std::clamp<int32_t>(numCores - 1, kMinimumPoolThreadCount,
|
||||
kMaximumPoolThreadCount);
|
||||
}
|
||||
|
||||
#if defined(MOZ_COLLECTING_RUNNABLE_TELEMETRY)
|
||||
|
Loading…
Reference in New Issue
Block a user