summaryrefslogtreecommitdiff
path: root/src/gc/gc.cpp
diff options
context:
space:
mode:
authorVarun Venkatesan <varun.k.venkatesan@intel.com>2019-03-01 16:41:09 -0800
committerMaoni Stephens <Maoni0@users.noreply.github.com>2019-03-01 16:41:09 -0800
commitc1801e85024add717f518feb6a9caed60d54500f (patch)
tree5095d114bcc0251aef8885b8a146b10c80c383c1 /src/gc/gc.cpp
parent5c911a4f16668a07ac53c4e29d8128afae6ff0f0 (diff)
downloadcoreclr-c1801e85024add717f518feb6a9caed60d54500f.tar.gz
coreclr-c1801e85024add717f518feb6a9caed60d54500f.tar.bz2
coreclr-c1801e85024add717f518feb6a9caed60d54500f.zip
Revert heapcount and enable CPU Groups to fix Ubuntu FPE (#22861)
Diffstat (limited to 'src/gc/gc.cpp')
-rw-r--r--src/gc/gc.cpp24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/gc/gc.cpp b/src/gc/gc.cpp
index d5a18b1785..95fe21ccb6 100644
--- a/src/gc/gc.cpp
+++ b/src/gc/gc.cpp
@@ -34206,7 +34206,10 @@ HRESULT GCHeap::Initialize()
#ifdef MULTIPLE_HEAPS
nhp_from_config = static_cast<uint32_t>(GCConfig::GetHeapCount());
- uint32_t nhp_from_process = GCToOSInterface::GetCurrentProcessCpuCount();
+ // GetCurrentProcessCpuCount only returns up to 64 procs.
+ uint32_t nhp_from_process = GCToOSInterface::CanEnableGCCPUGroups() ?
+ GCToOSInterface::GetTotalProcessorCount():
+ GCToOSInterface::GetCurrentProcessCpuCount();
if (nhp_from_config)
{
@@ -34237,6 +34240,20 @@ HRESULT GCHeap::Initialize()
{
pmask &= smask;
+#ifdef FEATURE_PAL
+ // GetCurrentProcessAffinityMask can return pmask=0 and smask=0 on
+ // systems with more than 1 NUMA node. The pmask decides the
+ // number of GC heaps to be used and the processors they are
+ // affinitized with. So pmask is now set to reflect that 64
+ // processors are available to begin with. The actual processors in
+ // the system may be lower and are taken into account before
+ // finalizing the number of heaps.
+ if (!pmask)
+ {
+ pmask = SIZE_T_MAX;
+ }
+#endif // FEATURE_PAL
+
if (gc_thread_affinity_mask)
{
pmask &= gc_thread_affinity_mask;
@@ -34253,6 +34270,11 @@ HRESULT GCHeap::Initialize()
}
nhp = min (nhp, set_bits_in_pmask);
+
+#ifdef FEATURE_PAL
+ // Limit the GC heaps to the number of processors available in the system.
+ nhp = min (nhp, GCToOSInterface::GetTotalProcessorCount());
+#endif // FEATURE_PAL
}
else
{