summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVladimir Sadov <vsadov@microsoft.com>2020-01-14 19:31:01 -0800
committerGitHub <noreply@github.com>2020-01-14 19:31:01 -0800
commitc43d0336eb999fe3bc7bf5873effe89cee716c69 (patch)
tree77fdd42e9c6da72035ee7773353e3f847bc92104 /src
parent2f99ca8652bd31755aac431dc1bff8a4dda888eb (diff)
downloadcoreclr-c43d0336eb999fe3bc7bf5873effe89cee716c69.tar.gz
coreclr-c43d0336eb999fe3bc7bf5873effe89cee716c69.tar.bz2
coreclr-c43d0336eb999fe3bc7bf5873effe89cee716c69.zip
Revert CPU clipping in the presence of CPU quota to 3.0, 2.x behavior.
Basically reverting https://github.com/dotnet/coreclr/pull/26806
Diffstat (limited to 'src')
-rw-r--r--src/classlibnative/bcltype/system.cpp7
-rw-r--r--src/pal/src/thread/process.cpp6
-rw-r--r--src/utilcode/util.cpp4
3 files changed, 17 insertions, 0 deletions
diff --git a/src/classlibnative/bcltype/system.cpp b/src/classlibnative/bcltype/system.cpp
index 402a215e9f..e38f7db292 100644
--- a/src/classlibnative/bcltype/system.cpp
+++ b/src/classlibnative/bcltype/system.cpp
@@ -352,6 +352,13 @@ INT32 QCALLTYPE SystemNative::GetProcessorCount()
processorCount = systemInfo.dwNumberOfProcessors;
}
+#ifdef FEATURE_PAL
+ uint32_t cpuLimit;
+
+ if (PAL_GetCpuLimit(&cpuLimit) && cpuLimit < (uint32_t)processorCount)
+ processorCount = cpuLimit;
+#endif
+
END_QCALL;
return processorCount;
diff --git a/src/pal/src/thread/process.cpp b/src/pal/src/thread/process.cpp
index 4f9d318bef..4b77f6327d 100644
--- a/src/pal/src/thread/process.cpp
+++ b/src/pal/src/thread/process.cpp
@@ -2558,6 +2558,12 @@ PAL_GetCPUBusyTime(
{
return 0;
}
+
+ UINT cpuLimit;
+ if (PAL_GetCpuLimit(&cpuLimit) && cpuLimit < dwNumberOfProcessors)
+ {
+ dwNumberOfProcessors = cpuLimit;
+ }
}
if (getrusage(RUSAGE_SELF, &resUsage) == -1)
diff --git a/src/utilcode/util.cpp b/src/utilcode/util.cpp
index e0f0200076..5c35b1ab5f 100644
--- a/src/utilcode/util.cpp
+++ b/src/utilcode/util.cpp
@@ -1289,6 +1289,10 @@ int GetCurrentProcessCpuCount()
#else // !FEATURE_PAL
count = PAL_GetLogicalCpuCountFromOS();
+
+ uint32_t cpuLimit;
+ if (PAL_GetCpuLimit(&cpuLimit) && cpuLimit < count)
+ count = cpuLimit;
#endif // !FEATURE_PAL
cCPUs = count;