Skip to content

Commit

Permalink
Merge pull request eclipse-omr#7068 from kangyining/Fix_aborted_scav_…
Browse files Browse the repository at this point in the history
…wrong_reclaim_memory

Nest percolate gc for aborted scavenge
  • Loading branch information
babsingh authored Aug 1, 2023
2 parents cbe1877 + 2ee2f75 commit 95dc2e9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 16 deletions.
12 changes: 0 additions & 12 deletions gc/base/GCCode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ MM_GCCode::isExplicitGC() const
case J9MMCONSTANT_IMPLICIT_GC_PERCOLATE_CRITICAL_REGIONS:
case J9MMCONSTANT_IMPLICIT_GC_PERCOLATE_UNLOADING_CLASSES:
case J9MMCONSTANT_IMPLICIT_GC_COMPLETE_CONCURRENT:
#if defined(OMR_GC_CONCURRENT_SCAVENGER)
case J9MMCONSTANT_IMPLICIT_GC_PERCOLATE_ABORTED_SCAVENGE:
#endif /* defined(OMR_GC_CONCURRENT_SCAVENGER) */
explicitGC = false;
break;
case J9MMCONSTANT_EXPLICIT_GC_NATIVE_OUT_OF_MEMORY:
Expand Down Expand Up @@ -88,9 +86,7 @@ MM_GCCode::shouldAggressivelyCompact() const
case J9MMCONSTANT_IMPLICIT_GC_PERCOLATE_CRITICAL_REGIONS:
case J9MMCONSTANT_IMPLICIT_GC_PERCOLATE_UNLOADING_CLASSES:
case J9MMCONSTANT_IMPLICIT_GC_COMPLETE_CONCURRENT:
#if defined(OMR_GC_CONCURRENT_SCAVENGER)
case J9MMCONSTANT_IMPLICIT_GC_PERCOLATE_ABORTED_SCAVENGE:
#endif /* defined(OMR_GC_CONCURRENT_SCAVENGER) */
#if defined(OMR_GC_IDLE_HEAP_MANAGER)
case J9MMCONSTANT_EXPLICIT_GC_IDLE_GC:
#endif /* defined(OMR_GC_IDLE_HEAP_MANAGER) */
Expand Down Expand Up @@ -128,9 +124,7 @@ MM_GCCode::isOutOfMemoryGC() const
case J9MMCONSTANT_IMPLICIT_GC_PERCOLATE_CRITICAL_REGIONS:
case J9MMCONSTANT_IMPLICIT_GC_PERCOLATE_UNLOADING_CLASSES:
case J9MMCONSTANT_IMPLICIT_GC_COMPLETE_CONCURRENT:
#if defined(OMR_GC_CONCURRENT_SCAVENGER)
case J9MMCONSTANT_IMPLICIT_GC_PERCOLATE_ABORTED_SCAVENGE:
#endif /* defined(OMR_GC_CONCURRENT_SCAVENGER) */
#if defined(OMR_GC_IDLE_HEAP_MANAGER)
case J9MMCONSTANT_EXPLICIT_GC_IDLE_GC:
#endif /* defined(OMR_GC_IDLE_HEAP_MANAGER) */
Expand Down Expand Up @@ -172,9 +166,7 @@ MM_GCCode::isAggressiveGC() const
case J9MMCONSTANT_IMPLICIT_GC_PERCOLATE_CRITICAL_REGIONS:
case J9MMCONSTANT_IMPLICIT_GC_PERCOLATE_UNLOADING_CLASSES:
case J9MMCONSTANT_IMPLICIT_GC_COMPLETE_CONCURRENT:
#if defined(OMR_GC_CONCURRENT_SCAVENGER)
case J9MMCONSTANT_IMPLICIT_GC_PERCOLATE_ABORTED_SCAVENGE:
#endif /* defined(OMR_GC_CONCURRENT_SCAVENGER) */
aggressiveGC = false;
break;
default:
Expand Down Expand Up @@ -212,9 +204,7 @@ MM_GCCode::isImplicitAggressiveGC() const
case J9MMCONSTANT_IMPLICIT_GC_PERCOLATE_CRITICAL_REGIONS:
case J9MMCONSTANT_IMPLICIT_GC_PERCOLATE_UNLOADING_CLASSES:
case J9MMCONSTANT_IMPLICIT_GC_COMPLETE_CONCURRENT:
#if defined(OMR_GC_CONCURRENT_SCAVENGER)
case J9MMCONSTANT_IMPLICIT_GC_PERCOLATE_ABORTED_SCAVENGE:
#endif /* defined(OMR_GC_CONCURRENT_SCAVENGER) */
implicitAggressiveGC = false;
break;
default:
Expand All @@ -239,9 +229,7 @@ MM_GCCode::isPercolateGC() const
case J9MMCONSTANT_IMPLICIT_GC_PERCOLATE_AGGRESSIVE:
case J9MMCONSTANT_IMPLICIT_GC_PERCOLATE_CRITICAL_REGIONS:
case J9MMCONSTANT_IMPLICIT_GC_PERCOLATE_UNLOADING_CLASSES:
#if defined(OMR_GC_CONCURRENT_SCAVENGER)
case J9MMCONSTANT_IMPLICIT_GC_PERCOLATE_ABORTED_SCAVENGE:
#endif /* defined(OMR_GC_CONCURRENT_SCAVENGER) */
percolateGC = true;
break;
case J9MMCONSTANT_EXPLICIT_GC_NATIVE_OUT_OF_MEMORY:
Expand Down
10 changes: 8 additions & 2 deletions gc/base/standard/Scavenger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4632,15 +4632,13 @@ MM_Scavenger::internalGarbageCollect(MM_EnvironmentBase *envBase, MM_MemorySubSp
return true;
}

#if defined(OMR_GC_CONCURRENT_SCAVENGER)
if (IS_CONCURRENT_ENABLED && isBackOutFlagRaised()) {
bool result = percolateGarbageCollect(env, subSpace, NULL, ABORTED_SCAVENGE, J9MMCONSTANT_IMPLICIT_GC_PERCOLATE_ABORTED_SCAVENGE);

Assert_MM_true(result);

return true;
}
#endif

/* First, if the previous scavenge had a failed tenure of a size greater than the threshold,
* ask parent MSS to try a collect.
Expand Down Expand Up @@ -4792,6 +4790,14 @@ MM_Scavenger::internalGarbageCollect(MM_EnvironmentBase *envBase, MM_MemorySubSp
#endif
{
mainThreadGarbageCollect(env, allocDescription);
/* We want to recursively call percolate gc here in order that the excessive gc
* identifies the outermost gc and records the metrics correctly.
*/
if (isBackOutFlagRaised()) {
bool result = percolateGarbageCollect(env, subSpace, NULL, ABORTED_SCAVENGE, J9MMCONSTANT_IMPLICIT_GC_PERCOLATE_ABORTED_SCAVENGE);
Assert_MM_true(result);
return true;
}
}

/* If we know now that the next scavenge will cause a peroclate broadcast
Expand Down
2 changes: 0 additions & 2 deletions include_core/j9nongenerated.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,7 @@ typedef struct J9VMGC_SublistFragment {
#define J9MMCONSTANT_IMPLICIT_GC_EXCESSIVE 8
#define J9MMCONSTANT_IMPLICIT_GC_PERCOLATE_UNLOADING_CLASSES 9
#define J9MMCONSTANT_IMPLICIT_GC_PERCOLATE_CRITICAL_REGIONS 10
#if defined(OMR_GC_CONCURRENT_SCAVENGER)
#define J9MMCONSTANT_IMPLICIT_GC_PERCOLATE_ABORTED_SCAVENGE 11
#endif
#if defined(OMR_GC_IDLE_HEAP_MANAGER)
#define J9MMCONSTANT_EXPLICIT_GC_IDLE_GC 12
#endif
Expand Down

0 comments on commit 95dc2e9

Please sign in to comment.