summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJan Kotas <jkotas@microsoft.com>2019-10-14 10:25:34 -0700
committerGitHub <noreply@github.com>2019-10-14 10:25:34 -0700
commitbf94cab3387eb235e339c22f251122d582b0cd46 (patch)
treea57987708c2b647a138a0c1c5f5c5839ab7f2776 /src
parentff243be899fae73904a1bf5401ecb93b6e80d85c (diff)
downloadcoreclr-bf94cab3387eb235e339c22f251122d582b0cd46.tar.gz
coreclr-bf94cab3387eb235e339c22f251122d582b0cd46.tar.bz2
coreclr-bf94cab3387eb235e339c22f251122d582b0cd46.zip
Enable optimized single-proc allocation helpers for single-proc x86/x64 systems only (#27014) (#27080)
Use maximum number of processors the process may run on to determine whether it is ok to use single-proc allocation helpers. It is not sufficient to depend on current process affinity since that can change during the process lifetime. Also, the single-proc allocation helpers work well on x86/x64 systems only because of they depend on atomic non-interlocked increment instruction for good performance. Such instruction is available on x86/x64 only. Disable them everywhere else. Fixes #26990
Diffstat (limited to 'src')
-rw-r--r--src/vm/gcheaputilities.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/vm/gcheaputilities.h b/src/vm/gcheaputilities.h
index 40889e9209..11f066c512 100644
--- a/src/vm/gcheaputilities.h
+++ b/src/vm/gcheaputilities.h
@@ -122,12 +122,12 @@ public:
static bool UseThreadAllocationContexts()
{
- // When running on a single-proc system, it's more efficient to use a single global
+ // When running on a single-proc Intel system, it's more efficient to use a single global
// allocation context for SOH allocations than to use one for every thread.
-#if defined(_TARGET_ARM_) || defined(FEATURE_PAL) || defined(FEATURE_REDHAWK)
- return true;
+#if (defined(_TARGET_X86_) || defined(_TARGET_AMD64_)) && !defined(FEATURE_PAL)
+ return IsServerHeap() || ::g_SystemInfo.dwNumberOfProcessors != 1 || CPUGroupInfo::CanEnableGCCPUGroups();
#else
- return IsServerHeap() || ::GetCurrentProcessCpuCount() != 1;
+ return true;
#endif
}