summaryrefslogtreecommitdiff
path: root/src/pal/src
diff options
context:
space:
mode:
authorJan Vorlicek <janvorli@microsoft.com>2019-04-10 12:08:27 +0200
committerJan Vorlicek <janvorli@microsoft.com>2019-04-10 12:08:27 +0200
commit3c07febf02b67c4c5f8eef846d5aa581372e454e (patch)
tree38599b7cf17576543ec677ab41f07d24a30b13f0 /src/pal/src
parentcee1a8c9d9c6669318d1567c85457fbcd642587d (diff)
downloadcoreclr-3c07febf02b67c4c5f8eef846d5aa581372e454e.tar.gz
coreclr-3c07febf02b67c4c5f8eef846d5aa581372e454e.tar.bz2
coreclr-3c07febf02b67c4c5f8eef846d5aa581372e454e.zip
Fix RecycledLists size on Unix
The list size was set to g_SystemInfo.dwNumberOfProcessors which is a number of processors the current process is allowed to run on, but not the total number of processors in the system. Fixed to use PAL_GetTotalCpuCount. Also revert a change to the mbind node mask length computation I've incorrectly made in my last commit and make it clear that the value is a number of used bits in the node mask, which is the highest numa node plus 1. And finally, re-reading the mbind doc, I've found that the maxnode parameter is in fact "number of nodes" in the mask, so fixing that too.
Diffstat (limited to 'src/pal/src')
-rw-r--r--src/pal/src/numa/numa.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/pal/src/numa/numa.cpp b/src/pal/src/numa/numa.cpp
index aabb800bac..4a07068ba4 100644
--- a/src/pal/src/numa/numa.cpp
+++ b/src/pal/src/numa/numa.cpp
@@ -204,7 +204,8 @@ VirtualAllocExNuma(
#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);
@@ -212,7 +213,7 @@ VirtualAllocExNuma(
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