Skip to content

Commit

Permalink
Merge pull request #20568 from ymanton/disclaim-scc
Browse files Browse the repository at this point in the history
Enable SCC disclaiming and tweak GC DNSS for InstantOn
  • Loading branch information
mpirvu authored Nov 14, 2024
2 parents 261100b + 0aab9d6 commit 27fba55
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 8 deletions.
12 changes: 6 additions & 6 deletions runtime/compiler/control/HookedByTheJit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4613,7 +4613,7 @@ void memoryDisclaimLogic(TR::CompilationInfo *compInfo, uint64_t crtElapsedTime,
if (sharedCache && sharedCache->isDisclaimEnabled())
{
// Disclaim if there was a large time interval since the last disclaim
if (crtElapsedTime > lastSCCDisclaimTime + 12 * TR::Options::_minTimeBetweenMemoryDisclaims)
if (crtElapsedTime > lastSCCDisclaimTime + TR::Options::_minTimeBetweenMemoryDisclaims)
{
disclaimSharedClassCache(sharedCache, crtElapsedTime);
lastSCCDisclaimTime = crtElapsedTime;
Expand All @@ -4624,12 +4624,12 @@ void memoryDisclaimLogic(TR::CompilationInfo *compInfo, uint64_t crtElapsedTime,
if (TR_DataCacheManager::getManager()->isDisclaimEnabled())
{
// Ensure we don't do it too often
if (crtElapsedTime > lastDataCacheDisclaimTime + TR::Options::_minTimeBetweenMemoryDisclaims)
if (crtElapsedTime > lastDataCacheDisclaimTime + 10 * TR::Options::_minTimeBetweenMemoryDisclaims)
{
// Disclaim if at least one data cache has been allocated since the last disclaim
// or if there was a large time interval since the last disclaim
if (TR_DataCacheManager::getManager()->numAllocatedCaches() > lastNumAllocatedDataCaches ||
crtElapsedTime > lastDataCacheDisclaimTime + 12 * TR::Options::_minTimeBetweenMemoryDisclaims)
crtElapsedTime > lastDataCacheDisclaimTime + 120 * TR::Options::_minTimeBetweenMemoryDisclaims)
{
disclaimDataCaches(crtElapsedTime);
lastDataCacheDisclaimTime = crtElapsedTime; // Update the time when disclaim was last performed
Expand All @@ -4642,12 +4642,12 @@ void memoryDisclaimLogic(TR::CompilationInfo *compInfo, uint64_t crtElapsedTime,
if (TR::CodeCacheManager::instance()->isDisclaimEnabled())
{
// Ensure we don't do it too often
if (crtElapsedTime > lastCodeCacheDisclaimTime + TR::Options::_minTimeBetweenMemoryDisclaims)
if (crtElapsedTime > lastCodeCacheDisclaimTime + 10 * TR::Options::_minTimeBetweenMemoryDisclaims)
{
// Disclaim if at least one code cache has been allocated since the last disclaim
// or if there was a large time interval since the last disclaim
if (TR::CodeCacheManager::instance()->getCurrentNumberOfCodeCaches() > lastNumAllocatedCodeCaches ||
crtElapsedTime > lastCodeCacheDisclaimTime + 12 * TR::Options::_minTimeBetweenMemoryDisclaims)
crtElapsedTime > lastCodeCacheDisclaimTime + 120 * TR::Options::_minTimeBetweenMemoryDisclaims)
{
static OMR::RSSReport *rssReport = OMR::RSSReport::instance();

Expand All @@ -4673,7 +4673,7 @@ void memoryDisclaimLogic(TR::CompilationInfo *compInfo, uint64_t crtElapsedTime,
TR::PersistentAllocator * iprofilerAllocator = TR_IProfiler::allocator();
if (iprofilerAllocator->isDisclaimEnabled())
{
if (crtElapsedTime > lastIProfilerDisclaimTime + TR::Options::_minTimeBetweenMemoryDisclaims &&
if (crtElapsedTime > lastIProfilerDisclaimTime + 10 * TR::Options::_minTimeBetweenMemoryDisclaims &&
// Avoid disclaiming IProfiler segments if IProfiler is still active
returnIprofilerState() == IPROFILING_STATE_OFF &&
// Avoid disclaiming if compilations are still to pe performed
Expand Down
10 changes: 8 additions & 2 deletions runtime/compiler/control/J9Options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ int32_t J9::Options::_TLHPrefetchStaggeredLineCount = 0;
int32_t J9::Options::_TLHPrefetchBoundaryLineCount = 0;
int32_t J9::Options::_TLHPrefetchTLHEndLineCount = 0;

int32_t J9::Options::_minTimeBetweenMemoryDisclaims = 5000; // ms
int32_t J9::Options::_minTimeBetweenMemoryDisclaims = 500; // ms

int32_t J9::Options::_numFirstTimeCompilationsToExitIdleMode = 25; // Use a large number to disable the feature
int32_t J9::Options::_waitTimeToEnterIdleMode = 5000; // ms
Expand Down Expand Up @@ -1120,7 +1120,7 @@ TR::OptionTable OMR::Options::_feOptions[] = {
{"minSuperclassArraySize=", "I<nnn>\t set the size of the minimum superclass array size",
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_minimumSuperclassArraySize, 0, "F%d", NOT_IN_SUBSET},
{"minTimeBetweenMemoryDisclaims=", "M<nnn>\tMinimum time (ms) between two consecutive memory disclaim operations",
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_minTimeBetweenMemoryDisclaims, 5000, "F%d", NOT_IN_SUBSET},
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_minTimeBetweenMemoryDisclaims, 500, "F%d", NOT_IN_SUBSET},
{"noregmap", 0, RESET_JITCONFIG_RUNTIME_FLAG(J9JIT_CG_REGISTER_MAPS) },
{"numCodeCachesOnStartup=", "R<nnn>\tnumber of code caches to create at startup",
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_numCodeCachesToCreateAtStartup, 0, "F%d", NOT_IN_SUBSET},
Expand Down Expand Up @@ -2605,6 +2605,11 @@ J9::Options::fePreProcess(void * base)
}
}

#if defined(J9VM_OPT_CRIU_SUPPORT)
if (vm->internalVMFunctions->isCRaCorCRIUSupportEnabled(vm))
self()->setOption(TR_EnableSharedCacheDisclaiming);
#endif /* defined(J9VM_OPT_CRIU_SUPPORT) */

int32_t xxEnableTrackAOTDependenciesArgIndex = FIND_ARG_IN_VMARGS(EXACT_MATCH, J9::Options::_externalOptionStrings[J9::ExternalOptions::XXplusTrackAOTDependencies], 0);
int32_t xxDisableTrackAOTDependenciesArgIndex = FIND_ARG_IN_VMARGS(EXACT_MATCH, J9::Options::_externalOptionStrings[J9::ExternalOptions::XXminusTrackAOTDependencies], 0);
if (xxEnableTrackAOTDependenciesArgIndex > xxDisableTrackAOTDependenciesArgIndex)
Expand Down Expand Up @@ -2773,6 +2778,7 @@ J9::Options::fePreProcess(void * base)
self()->setOption(TR_DisableDataCacheDisclaiming);
self()->setOption(TR_DisableIProfilerDataDisclaiming);
self()->setOption(TR_EnableCodeCacheDisclaiming, false);
self()->setOption(TR_EnableSharedCacheDisclaiming, false);
}

return true;
Expand Down
16 changes: 16 additions & 0 deletions runtime/gc_glue_java/ConfigurationDelegate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,22 @@ class MM_ConfigurationDelegate
if (!_extensions->dynamicClassUnloadingKickoffThresholdForced) {
_extensions->dynamicClassUnloadingKickoffThreshold = DYNAMIC_CLASS_UNLOADING_KICKOFF_THRESHOLD;
}

#if defined(J9VM_OPT_CRIU_SUPPORT)
/* Favour reduced memory consumption over pause times when checkpointing is enabled by
* scaling the default min and max DNSS expected ratios by a constant factor, unless
* at least one ratio was directly specified by the user.
*/
if (javaVM->internalVMFunctions->isCRaCorCRIUSupportEnabled(javaVM)) {
const double scaleFactor = 2;
if (!_extensions->dnssExpectedRatioMaximum._wasSpecified &&
!_extensions->dnssExpectedRatioMinimum._wasSpecified) {
_extensions->dnssExpectedRatioMaximum._valueSpecified *= scaleFactor;
_extensions->dnssExpectedRatioMinimum._valueSpecified *= scaleFactor;
}
}
#endif /* defined(J9VM_OPT_CRIU_SUPPORT) */

return true;
}

Expand Down

0 comments on commit 27fba55

Please sign in to comment.