summaryrefslogtreecommitdiff
path: root/src/utilcode/util.cpp
diff options
context:
space:
mode:
authorJan Vorlicek <janvorli@microsoft.com>2019-04-05 02:53:32 +0200
committerJan Vorlicek <janvorli@microsoft.com>2019-04-09 01:26:55 +0200
commit060990945a0117cb824b9d1c1e6c3a336533a3ee (patch)
treee762ccb63b9843ccf75d6f87b6ab14cfe352d40c /src/utilcode/util.cpp
parent187410154a323024938a3281fb5a49f5e59ec350 (diff)
downloadcoreclr-060990945a0117cb824b9d1c1e6c3a336533a3ee.tar.gz
coreclr-060990945a0117cb824b9d1c1e6c3a336533a3ee.tar.bz2
coreclr-060990945a0117cb824b9d1c1e6c3a336533a3ee.zip
Remove Unix CPU groups emulation
This change removes CPU groups emulation from Unix PAL and modifies the GC and thread pool code accordingly.
Diffstat (limited to 'src/utilcode/util.cpp')
-rw-r--r--src/utilcode/util.cpp32
1 files changed, 19 insertions, 13 deletions
diff --git a/src/utilcode/util.cpp b/src/utilcode/util.cpp
index 61f41d7a22..e7091604af 100644
--- a/src/utilcode/util.cpp
+++ b/src/utilcode/util.cpp
@@ -733,10 +733,17 @@ BYTE * ClrVirtualAllocWithinRange(const BYTE *pMinAddr,
return ::VirtualAllocExNuma(hProc, lpAddr, dwSize, allocType, prot, node);
}
+#ifndef FEATURE_PAL
/*static*/ BOOL NumaNodeInfo::GetNumaProcessorNodeEx(PPROCESSOR_NUMBER proc_no, PUSHORT node_no)
{
return ::GetNumaProcessorNodeEx(proc_no, node_no);
}
+#else // !FEATURE_PAL
+/*static*/ BOOL NumaNodeInfo::GetNumaProcessorNodeEx(USHORT proc_no, PUSHORT node_no)
+{
+ return PAL_GetNumaProcessorNode(proc_no, node_no);
+}
+#endif // !FEATURE_PAL
#endif
/*static*/ BOOL NumaNodeInfo::m_enableGCNumaAware = FALSE;
@@ -749,15 +756,6 @@ BYTE * ClrVirtualAllocWithinRange(const BYTE *pMinAddr,
if (CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_GCNumaAware) == 0)
return FALSE;
-#ifndef FEATURE_PAL
- // check if required APIs are supported
- HMODULE hMod = GetModuleHandleW(WINDOWS_KERNEL32_DLLNAME_W);
-#else
- HMODULE hMod = GetCLRModule();
-#endif
- if (hMod == NULL)
- return FALSE;
-
// fail to get the highest numa node number
if (!::GetNumaHighestNodeNumber(&highest) || (highest == 0))
return FALSE;
@@ -778,8 +776,10 @@ BYTE * ClrVirtualAllocWithinRange(const BYTE *pMinAddr,
m_enableGCNumaAware = InitNumaNodeInfoAPI();
}
+#ifndef FEATURE_PAL
+
//******************************************************************************
-// NumaNodeInfo
+// CPUGroupInfo
//******************************************************************************
#if !defined(FEATURE_REDHAWK)
/*static*/ //CPUGroupInfo::PNTQSIEx CPUGroupInfo::m_pNtQuerySystemInformationEx = NULL;
@@ -1187,6 +1187,7 @@ BOOL CPUGroupInfo::GetCPUGroupRange(WORD group_number, WORD* group_begin, WORD*
LIMITED_METHOD_CONTRACT;
return m_threadUseAllCpuGroups;
}
+#endif // !FEATURE_PAL
//******************************************************************************
// Returns the number of processors that a process has been configured to run on
@@ -1206,6 +1207,8 @@ int GetCurrentProcessCpuCount()
return cCPUs;
unsigned int count = 0;
+
+#ifndef FEATURE_PAL
DWORD_PTR pmask, smask;
if (!GetProcessAffinityMask(GetCurrentProcess(), &pmask, &smask))
@@ -1233,18 +1236,20 @@ int GetCurrentProcessCpuCount()
count = 64;
}
-#ifdef FEATURE_PAL
- uint32_t cpuLimit;
+#else // !FEATURE_PAL
+ count = PAL_GetLogicalCpuCountFromOS();
+ uint32_t cpuLimit;
if (PAL_GetCpuLimit(&cpuLimit) && cpuLimit < count)
count = cpuLimit;
-#endif
+#endif // !FEATURE_PAL
cCPUs = count;
return count;
}
+#ifndef FEATURE_PAL
DWORD_PTR GetCurrentProcessCpuMask()
{
CONTRACTL
@@ -1266,6 +1271,7 @@ DWORD_PTR GetCurrentProcessCpuMask()
return 0;
#endif
}
+#endif // !FEATURE_PAL
uint32_t GetOsPageSizeUncached()
{