{
if ((int)node <= g_highestNumaNode)
{
- int nodeMaskLength = (g_highestNumaNode + sizeof(unsigned long) - 1) / sizeof(unsigned long);
+ int usedNodeMaskBits = g_highestNumaNode + 1;
+ int nodeMaskLength = (usedNodeMaskBits + sizeof(unsigned long) - 1) / sizeof(unsigned long);
unsigned long *nodeMask = (unsigned long*)alloca(nodeMaskLength * sizeof(unsigned long));
memset(nodeMask, 0, nodeMaskLength);
int mask = ((unsigned long)1) << (node & (sizeof(unsigned long) - 1));
nodeMask[index] = mask;
- int st = mbind(address, size, MPOL_PREFERRED, nodeMask, g_highestNumaNode, 0);
+ int st = mbind(address, size, MPOL_PREFERRED, nodeMask, usedNodeMaskBits, 0);
assert(st == 0);
// If the mbind fails, we still return the allocated memory since the node is just a hint
}
#if HAVE_NUMA_H
if (result != NULL && g_numaAvailable)
{
- int nodeMaskLength = (g_highestNumaNode + sizeof(unsigned long) - 1) / sizeof(unsigned long);
+ int usedNodeMaskBits = g_highestNumaNode + 1;
+ int nodeMaskLength = (usedNodeMaskBits + sizeof(unsigned long) - 1) / sizeof(unsigned long);
unsigned long *nodeMask = (unsigned long*)alloca(nodeMaskLength * sizeof(unsigned long));
memset(nodeMask, 0, nodeMaskLength);
int mask = ((unsigned long)1) << (nndPreferred & (sizeof(unsigned long) - 1));
nodeMask[index] = mask;
- int st = mbind(result, dwSize, MPOL_PREFERRED, nodeMask, g_highestNumaNode, 0);
+ int st = mbind(result, dwSize, MPOL_PREFERRED, nodeMask, usedNodeMaskBits, 0);
_ASSERTE(st == 0);
// If the mbind fails, we still return the allocated memory since the nndPreferred is just a hint
else
RecycledLists.Initialize( g_SystemInfo.dwNumberOfProcessors );
#else // !FEATURE_PAL
- RecycledLists.Initialize( g_SystemInfo.dwNumberOfProcessors );
+ RecycledLists.Initialize( PAL_GetTotalCpuCount() );
#endif // !FEATURE_PAL
}
EX_CATCH
RetiredCPWakeupEvent = NULL;
}
- // Note: It is fine to call Destroy on unitialized critical sections
+ // Note: It is fine to call Destroy on uninitialized critical sections
WorkerCriticalSection.Destroy();
WaitThreadsCriticalSection.Destroy();
TimerQueueCriticalSection.Destroy();