diff --git a/gc/base/Configuration.cpp b/gc/base/Configuration.cpp index bfa12023a1f..dfd0ed7427d 100644 --- a/gc/base/Configuration.cpp +++ b/gc/base/Configuration.cpp @@ -447,13 +447,14 @@ MM_Configuration::initializeGCThreadCount(MM_EnvironmentBase* env) { MM_GCExtensionsBase* extensions = env->getExtensions(); + /* to be checked against gcThreadCountSpecified, once downstream projects properly set it */ if (!extensions->gcThreadCountForced) { - extensions->gcThreadCount = supportedGCThreadCount(env); + extensions->gcThreadCount = defaultGCThreadCount(env); } } uintptr_t -MM_Configuration::supportedGCThreadCount(MM_EnvironmentBase* env) +MM_Configuration::defaultGCThreadCount(MM_EnvironmentBase* env) { OMRPORT_ACCESS_FROM_OMRPORT(env->getPortLibrary()); uintptr_t threadCount = omrsysinfo_get_number_CPUs_by_type(OMRPORT_CPU_TARGET); diff --git a/gc/base/Configuration.hpp b/gc/base/Configuration.hpp index 4391d40f958..78dec7f346c 100644 --- a/gc/base/Configuration.hpp +++ b/gc/base/Configuration.hpp @@ -144,8 +144,8 @@ class MM_Configuration : public MM_BaseVirtual virtual void kill(MM_EnvironmentBase* env); - /* Number of GC threads supported based on hardware and dispatcher's max. */ - virtual uintptr_t supportedGCThreadCount(MM_EnvironmentBase* env); + /* Default number of GC threads based on h/w, os and container limits */ + virtual uintptr_t defaultGCThreadCount(MM_EnvironmentBase* env); /** * Sets the number of gc threads diff --git a/gc/base/GCExtensionsBase.hpp b/gc/base/GCExtensionsBase.hpp index 4290a72e440..2bce06cfc68 100644 --- a/gc/base/GCExtensionsBase.hpp +++ b/gc/base/GCExtensionsBase.hpp @@ -465,9 +465,9 @@ class MM_GCExtensionsBase : public MM_BaseVirtual { #endif /* defined(OMR_GC_BATCH_CLEAR_TLH) */ omrthread_monitor_t gcStatsMutex; uintptr_t gcThreadCount; /**< Initial number of GC threads - chosen default or specified in java options*/ - bool gcThreadCountForced; /**< true if number of GC threads is specified in java options. Currently we have a few ways to do this: - -Xgcthreads -Xthreads= (RT only) -XthreadCount= */ - uintptr_t dispatcherHybridNotifyThreadBound; /** Bound for determining hybrid notification type (Individual notifies for count < MIN(bound, maxThreads/2), otherwise notify_all) */ + bool gcThreadCountSpecified; /**< true if number of GC threads is specified in command line options. */ + bool gcThreadCountForced; /**< true if user forced a fixed number of GC threads. Default is false, but a command line option could set it if not wanting adaptive threading */ + uintptr_t dispatcherHybridNotifyThreadBound; /**< Bound for determining hybrid notification type (Individual notifies for count < MIN(bound, maxThreads/2), otherwise notify_all) */ #if defined(OMR_GC_MODRON_SCAVENGER) || defined(OMR_GC_VLHGC) enum ScavengerScanOrdering { @@ -1657,6 +1657,7 @@ class MM_GCExtensionsBase : public MM_BaseVirtual { , batchClearTLH(0) #endif /* defined(OMR_GC_BATCH_CLEAR_TLH) */ , gcThreadCount(0) + , gcThreadCountSpecified(false) , gcThreadCountForced(false) , dispatcherHybridNotifyThreadBound(16) #if defined(OMR_GC_MODRON_SCAVENGER) || defined(OMR_GC_VLHGC) diff --git a/gc/base/ParallelDispatcher.cpp b/gc/base/ParallelDispatcher.cpp index 29da51808aa..535b0bd0172 100644 --- a/gc/base/ParallelDispatcher.cpp +++ b/gc/base/ParallelDispatcher.cpp @@ -494,7 +494,7 @@ MM_ParallelDispatcher::adjustThreadCount(uintptr_t maxThreadCount) { uintptr_t toReturn = maxThreadCount; - /* Did user specify number of gc threads? */ + /* Did user force a fixed number of gc threads? */ if (!_extensions->gcThreadCountForced) { /* No ...Use a sensible number of threads for current heap size. Using too many * can lead to unacceptable pause times due to insufficient parallelism. Additionally, @@ -733,7 +733,7 @@ MM_ParallelDispatcher::expandThreadPool(MM_EnvironmentBase *env) Trc_MM_ParallelDispatcher_expandThreadPool_params( newThreadCount, _poolMaxCapacity, - _extensions->configuration->supportedGCThreadCount(env), preExpandThreadCount); + _extensions->configuration->defaultGCThreadCount(env), preExpandThreadCount); result = reinitializeThreadPool(env, newThreadCount); diff --git a/gc/base/j9mm.tdf b/gc/base/j9mm.tdf index 8b82fed22a1..eeb7aea249c 100644 --- a/gc/base/j9mm.tdf +++ b/gc/base/j9mm.tdf @@ -1007,7 +1007,7 @@ TraceEntry=Trc_MM_DoFixHeapForCompact_Entry Overhead=1 Level=1 Template="Trc_MM_ TraceExit=Trc_MM_DoFixHeapForCompact_Exit Overhead=1 Level=1 Template="Trc_MM_DoFixHeapForCompact Exit after fixing up %zu objects" TraceEntry=Trc_MM_ParallelDispatcher_expandThreadPool_Entry noEnv Overhead=1 Level=1 Group=dispatcher Template="expandThreadPool Entry" -TraceEvent=Trc_MM_ParallelDispatcher_expandThreadPool_params noEnv Overhead=1 Level=1 Group=dispatcher Template="expandThreadPool_params: newThreadCount: %zu, _threadCountMaximumAtCheckpointStartup: %zu, supportedGCThreadCount: %zu, preExpandThreadCount: %zu" +TraceEvent=Trc_MM_ParallelDispatcher_expandThreadPool_params noEnv Overhead=1 Level=1 Group=dispatcher Template="expandThreadPool_params: newThreadCount: %zu, _threadCountMaximumAtCheckpointStartup: %zu, defaultGCThreadCount: %zu, preExpandThreadCount: %zu" TraceExit=Trc_MM_ParallelDispatcher_expandThreadPool_Exit noEnv Overhead=1 Level=1 Group=dispatcher Template="expandThreadPool Exit: preExpandThreadCount: %zu, gcThreadCount: %zu, _threadShutdownCount: %zu" TraceEntry=Trc_MM_ParallelDispatcher_contractThreadPool_Entry noEnv Overhead=1 Level=1 Group=dispatcher Template="contractThreadPool Entry: gcThreadCount: %zu, requested newThreadCount: %zu"