summaryrefslogtreecommitdiff
path: root/src/vm/win32threadpool.cpp
diff options
context:
space:
mode:
authorLukasz Tomczyk <lutom@microsoft.com>2016-07-18 09:28:12 -0700
committerLukasz Tomczyk <lutom@microsoft.com>2016-08-02 16:14:43 -0700
commit0504bf7c2d8003e81b0c5ad6392831f36781470a (patch)
tree082e640539928a2ab3575aa0591faa61a5e5df3e /src/vm/win32threadpool.cpp
parent9a9096bc059c66dbed583cfe986cb2eb61cdfa17 (diff)
downloadcoreclr-0504bf7c2d8003e81b0c5ad6392831f36781470a.tar.gz
coreclr-0504bf7c2d8003e81b0c5ad6392831f36781470a.tar.bz2
coreclr-0504bf7c2d8003e81b0c5ad6392831f36781470a.zip
Expose ThreadPool_UnfairSemaphoreSpinLimit config
Spin-wait in ThreadpoolMgr::UnfairSemaphore::Wait can cause significant CPU usage, which is unnecessary in some scenarios, where threadpool receives work in bursts. Use of the above parameter will allow fine tuning of the threadpool behavior based on the workload expectation. Fix #5928
Diffstat (limited to 'src/vm/win32threadpool.cpp')
-rw-r--r--src/vm/win32threadpool.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/vm/win32threadpool.cpp b/src/vm/win32threadpool.cpp
index 35c2b64ac4..95fa5c0ca5 100644
--- a/src/vm/win32threadpool.cpp
+++ b/src/vm/win32threadpool.cpp
@@ -359,7 +359,8 @@ BOOL ThreadpoolMgr::Initialize()
RetiredCPWakeupEvent->CreateAutoEvent(FALSE);
_ASSERTE(RetiredCPWakeupEvent->IsValid());
- WorkerSemaphore = new UnfairSemaphore(ThreadCounter::MaxPossibleCount);
+ int spinLimitPerProcessor = CLRConfig::GetConfigValue(CLRConfig::INTERNAL_ThreadPool_UnfairSemaphoreSpinLimit);
+ WorkerSemaphore = new UnfairSemaphore(ThreadCounter::MaxPossibleCount, spinLimitPerProcessor);
RetiredWorkerSemaphore = new CLRSemaphore();
RetiredWorkerSemaphore->Create(0, ThreadCounter::MaxPossibleCount);