diff --git a/src/vm/win32threadpool.h b/src/vm/win32threadpool.h index 058eaf460150..d7479a9c1cb4 100644 --- a/src/vm/win32threadpool.h +++ b/src/vm/win32threadpool.h @@ -749,7 +749,9 @@ class ThreadpoolMgr #else // !FEATURE_PAL if (PAL_HasGetCurrentProcessorNumber()) { - processorNumber = GetCurrentProcessorNumber(); + // On linux, GetCurrentProcessorNumber which uses sched_getcpu() can return a value greater than the number + // of processors reported by sysconf(_SC_NPROCESSORS_ONLN) when using OpenVZ kernel. + processorNumber = GetCurrentProcessorNumber()%NumberOfProcessors; } #endif // !FEATURE_PAL return pRecycledListPerProcessor[processorNumber][memType];