Skip to content

Commit

Permalink
Merge pull request #3495 from amicic/bound_tenure_noCM
Browse files Browse the repository at this point in the history
Bound Tenure Expand
  • Loading branch information
charliegracie authored Feb 5, 2019
2 parents 49fe250 + 8648c0d commit dfbca14
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 2 deletions.
7 changes: 7 additions & 0 deletions gc/base/GCExtensionsBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,8 @@ class MM_GCExtensionsBase : public MM_BaseVirtual {

#if defined(OMR_GC_MODRON_SCAVENGER)
MM_SublistPool rememberedSet;
uintptr_t oldHeapSizeOnLastGlobalGC;
uintptr_t freeOldHeapSizeOnLastGlobalGC;
#endif /* OMR_GC_MODRON_SCAVENGER */
#if defined(OMR_GC_STACCATO)
MM_RememberedSetSATB* sATBBarrierRememberedSet; /**< The snapshot at the beginning barrier remembered set used for the write barrier */
Expand Down Expand Up @@ -1276,6 +1278,11 @@ class MM_GCExtensionsBase : public MM_BaseVirtual {
, requestedPageFlags(OMRPORT_VMEM_PAGE_FLAG_NOT_USED)
, gcmetadataPageSize(0)
, gcmetadataPageFlags(OMRPORT_VMEM_PAGE_FLAG_NOT_USED)
#if defined(OMR_GC_MODRON_SCAVENGER)
, rememberedSet()
, oldHeapSizeOnLastGlobalGC(UDATA_MAX)
, freeOldHeapSizeOnLastGlobalGC(UDATA_MAX)
#endif /* OMR_GC_MODRON_SCAVENGER */
#if defined(OMR_GC_STACCATO)
, sATBBarrierRememberedSet(NULL)
#endif /* OMR_GC_STACCATO */
Expand Down
4 changes: 4 additions & 0 deletions gc/base/gcutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ getPercolateReasonAsString(PercolateReason mode)
return "previous scavenge aborted";
case CONCURRENT_MARK_EXHAUSTED:
return "concurrent mark exhausted";
case PREVENT_TENURE_EXPAND:
return "prevent tenure expand";
case MET_PROJECTED_TENURE_MAX_FREE:
return "met projected tenure max free";
case NONE_SET:
default:
return "unknown";
Expand Down
2 changes: 2 additions & 0 deletions gc/base/j9mm.tdf
Original file line number Diff line number Diff line change
Expand Up @@ -912,3 +912,5 @@ TraceEvent=Trc_MM_LOAResize_expandWithRange2 Overhead=1 Level=1 Group=loaresize
TraceEvent=Trc_MM_LOAResize_contractWithRange Overhead=1 Level=1 Group=loaresize Template="LOA resized on heap contraction: heapSize %zu, LOA ratio is %.3f --> LOA base is now %p LOA size %zu"

TraceEvent=Trc_MM_Scavenger_percolate_concurrentMarkExhausted Overhead=1 Level=1 Group=percolate Template="Percolating due to exhausted Concurrent Mark"
TraceEvent=Trc_MM_Scavenger_percolate_preventTenureExpand Overhead=1 Level=1 Group=percolate Template="Percolating to prevent Tenure expand"
TraceEvent=Trc_MM_Scavenger_percolate_tenureMaxFree Overhead=1 Level=1 Group=percolate Template="Percolating due to meeting Tenure max free"
5 changes: 4 additions & 1 deletion gc/base/standard/ParallelGlobalGC.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 1991, 2018 IBM Corp. and others
* Copyright (c) 1991, 2019 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -540,6 +540,9 @@ MM_ParallelGlobalGC::masterThreadGarbageCollect(MM_EnvironmentBase *env, MM_Allo
#if defined(OMR_GC_MODRON_SCAVENGER)
/* Merge sublists in the remembered set (if necessary) */
_extensions->rememberedSet.compact(env);

_extensions->oldHeapSizeOnLastGlobalGC = _extensions->heap->getActiveMemorySize(MEMORY_TYPE_OLD);
_extensions->freeOldHeapSizeOnLastGlobalGC = _extensions->heap->getApproximateActiveFreeMemorySize(MEMORY_TYPE_OLD);
#endif /* OMR_GC_MODRON_SCAVENGER */

/* Restart the allocation caches associated to all threads */
Expand Down
24 changes: 24 additions & 0 deletions gc/base/standard/Scavenger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4284,6 +4284,30 @@ MM_Scavenger::internalGarbageCollect(MM_EnvironmentBase *envBase, MM_MemorySubSp
}
}

if (!_extensions->concurrentMark) {
uintptr_t previousUsedOldHeap = _extensions->oldHeapSizeOnLastGlobalGC - _extensions->freeOldHeapSizeOnLastGlobalGC;
float maxTenureFreeRatio = _extensions->heapFreeMaximumRatioMultiplier / 100.0f;
float midTenureFreeRatio = (_extensions->heapFreeMinimumRatioMultiplier + _extensions->heapFreeMaximumRatioMultiplier) / 200.0f;
uintptr_t soaFreeMemorySize = _extensions->heap->getApproximateActiveFreeMemorySize(MEMORY_TYPE_OLD) - _extensions->heap->getApproximateActiveFreeLOAMemorySize(MEMORY_TYPE_OLD);

/* We suspect that next scavegne will cause Tenure expansion, while Tenure free ratio is (was) already high enough */
if ((scavengerGCStats->_avgTenureBytes > soaFreeMemorySize) && (_extensions->freeOldHeapSizeOnLastGlobalGC > (_extensions->oldHeapSizeOnLastGlobalGC * midTenureFreeRatio))) {
Trc_MM_Scavenger_percolate_preventTenureExpand(env->getLanguageVMThread());

bool result = percolateGarbageCollect(env, subSpace, NULL, PREVENT_TENURE_EXPAND, J9MMCONSTANT_IMPLICIT_GC_PERCOLATE);
Assert_MM_true(result);
return true;
}
/* There was Tenure heap growth since last Global GC, and we suspect (assuming live set size did not grow) we might be going beyond max free bound. */
if ((_extensions->heap->getActiveMemorySize(MEMORY_TYPE_OLD) > _extensions->oldHeapSizeOnLastGlobalGC) && (_extensions->heap->getActiveMemorySize(MEMORY_TYPE_OLD) * maxTenureFreeRatio < (_extensions->heap->getActiveMemorySize(MEMORY_TYPE_OLD) - previousUsedOldHeap))) {
Trc_MM_Scavenger_percolate_tenureMaxFree(env->getLanguageVMThread());

bool result = percolateGarbageCollect(env, subSpace, NULL, MET_PROJECTED_TENURE_MAX_FREE, J9MMCONSTANT_IMPLICIT_GC_PERCOLATE);
Assert_MM_true(result);
return true;
}
}

/**
* Language percolation trigger
* Allow the CollectorLanguageInterface to advise if percolation should occur.
Expand Down
4 changes: 3 additions & 1 deletion include_core/omrgcconsts.h
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,9 @@ typedef enum {
EXPAND_FAILED,
ABORTED_SCAVENGE,
CRITICAL_REGIONS,
CONCURRENT_MARK_EXHAUSTED
CONCURRENT_MARK_EXHAUSTED,
PREVENT_TENURE_EXPAND,
MET_PROJECTED_TENURE_MAX_FREE
} PercolateReason;
/**
* @}
Expand Down

0 comments on commit dfbca14

Please sign in to comment.