Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit bf94cab

Browse files
authored
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
1 parent ff243be commit bf94cab

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/vm/gcheaputilities.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,12 @@ class GCHeapUtilities {
122122

123123
static bool UseThreadAllocationContexts()
124124
{
125-
// When running on a single-proc system, it's more efficient to use a single global
125+
// When running on a single-proc Intel system, it's more efficient to use a single global
126126
// allocation context for SOH allocations than to use one for every thread.
127-
#if defined(_TARGET_ARM_) || defined(FEATURE_PAL) || defined(FEATURE_REDHAWK)
128-
return true;
127+
#if (defined(_TARGET_X86_) || defined(_TARGET_AMD64_)) && !defined(FEATURE_PAL)
128+
return IsServerHeap() || ::g_SystemInfo.dwNumberOfProcessors != 1 || CPUGroupInfo::CanEnableGCCPUGroups();
129129
#else
130-
return IsServerHeap() || ::GetCurrentProcessCpuCount() != 1;
130+
return true;
131131
#endif
132132

133133
}

0 commit comments

Comments
 (0)