Skip to content

Commit

Permalink
Merge pull request eclipse-omr#7076 from kangyining/fix_MSSSS_log_fix
Browse files Browse the repository at this point in the history
Replace debug printf log with trace
  • Loading branch information
babsingh authored Aug 1, 2023
2 parents 95dc2e9 + dac230f commit 43a2b1d
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 31 deletions.
59 changes: 28 additions & 31 deletions gc/base/MemorySubSpaceSemiSpace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -464,28 +464,29 @@ MM_MemorySubSpaceSemiSpace::tearDown(MM_EnvironmentBase *env)
void
MM_MemorySubSpaceSemiSpace::flip(MM_EnvironmentBase *env, Flip_step step)
{
#if defined(OMR_GC_CONCURRENT_SCAVENGER)
OMRPORT_ACCESS_FROM_OMRPORT(env->getPortLibrary());
bool debug = _extensions->debugTiltedScavenge;
#endif
switch (step) {
case set_evacuate:
Trc_MM_MSSSS_flip_step(env->getLanguageVMThread(), "set_evacuate");
_memorySubSpaceEvacuate = _memorySubSpaceAllocate;
_memorySubSpaceEvacuate->isAllocatable(false);
break;
case set_allocate:
Trc_MM_MSSSS_flip_step(env->getLanguageVMThread(), "set_allocate");
_memorySubSpaceAllocate = _memorySubSpaceSurvivor;
_memorySubSpaceAllocate->isAllocatable(true);
/* Let know MemorySpace about new default MemorySubSpace */
getMemorySpace()->setDefaultMemorySubSpace(getDefaultMemorySubSpace());
break;
case disable_allocation:
Trc_MM_MSSSS_flip_step(env->getLanguageVMThread(), "disable_allocation");
_memorySubSpaceAllocate->isAllocatable(false);
break;
case restore_allocation:
Trc_MM_MSSSS_flip_step(env->getLanguageVMThread(), "restore_allocation");
_memorySubSpaceAllocate->isAllocatable(true);
break;
case restore_allocation_and_set_survivor:
Trc_MM_MSSSS_flip_step(env->getLanguageVMThread(), "restore_allocation_and_set_survivor");
_memorySubSpaceAllocate->isAllocatable(true);
_memorySubSpaceSurvivor = _memorySubSpaceEvacuate;
#if defined(OMR_GC_CONCURRENT_SCAVENGER)
Expand All @@ -509,20 +510,20 @@ MM_MemorySubSpaceSemiSpace::flip(MM_EnvironmentBase *env, Flip_step step)
_memorySubSpaceAllocate = _memorySubSpaceEvacuate;
_memorySubSpaceEvacuate = _memorySubSpaceSurvivor;
getMemorySpace()->setDefaultMemorySubSpace(getDefaultMemorySubSpace());
if (debug) {
omrtty_printf("tilt backout _allocateSpaceBase/Top %llx/%llx _survivorSpaceBase/Top %llx/%llx tilt sizes %llx %llx\n",
_allocateSpaceBase, _allocateSpaceTop, _survivorSpaceBase, _survivorSpaceTop,
(uintptr_t)_allocateSpaceTop - (uintptr_t)_allocateSpaceBase + (uintptr_t)_survivorSpaceTop - (uintptr_t)_survivorSpaceBase, (uintptr_t)0);
}
Trc_MM_MSSSS_flip_backout(
env->getLanguageVMThread(),
"",
_allocateSpaceBase, _allocateSpaceTop, _survivorSpaceBase, _survivorSpaceTop,
(uintptr_t)_allocateSpaceTop - (uintptr_t)_allocateSpaceBase + (uintptr_t)_survivorSpaceTop - (uintptr_t)_survivorSpaceBase, (uintptr_t)0);
} else {
_memorySubSpaceSurvivor = _memorySubSpaceEvacuate;
cacheRanges(_memorySubSpaceAllocate, &_allocateSpaceBase, &_allocateSpaceTop);
cacheRanges(_memorySubSpaceSurvivor, &_survivorSpaceBase, &_survivorSpaceTop);
if (debug) {
omrtty_printf("tilt backout forced flip _allocateSpaceBase/Top %llx/%llx _survivorSpaceBase/Top %llx/%llx tilt sizes %llx %llx\n",
_allocateSpaceBase, _allocateSpaceTop, _survivorSpaceBase, _survivorSpaceTop,
(uintptr_t)_allocateSpaceTop - (uintptr_t)_allocateSpaceBase + (uintptr_t)_survivorSpaceTop - (uintptr_t)_survivorSpaceBase, (uintptr_t)0);
}
Trc_MM_MSSSS_flip_backout(
env->getLanguageVMThread(),
"forced flip ",
_allocateSpaceBase, _allocateSpaceTop, _survivorSpaceBase, _survivorSpaceTop,
(uintptr_t)_allocateSpaceTop - (uintptr_t)_allocateSpaceBase + (uintptr_t)_survivorSpaceTop - (uintptr_t)_survivorSpaceBase, (uintptr_t)0);
}

/* Tilt 100% on PhysicalSubArena level (leave SubSpaces unchanged). Give everything to the low address (Allocate) part */
Expand All @@ -540,10 +541,9 @@ MM_MemorySubSpaceSemiSpace::flip(MM_EnvironmentBase *env, Flip_step step)
MM_HeapLinkedFreeHeader *lastFreeEntry = getDefaultMemorySubSpace()->getMemoryPool()->getLastFreeEntry();
if (NULL != lastFreeEntry) {
lastFreeEntrySize = lastFreeEntry->getSize();
if (debug) {
omrtty_printf("tilt restore_tilt_after_percolate last free entry %llx size %llx\n",
lastFreeEntry, lastFreeEntrySize);
}
Trc_MM_MSSSS_flip_restore_tilt_after_percolate(
env->getLanguageVMThread(),
lastFreeEntry, lastFreeEntrySize);
/* rely on the last free entry only if at the very end of SemiSpace (no objects after it) */
if (((uintptr_t)lastFreeEntry + lastFreeEntrySize) != OMR_MAX((uintptr_t)_allocateSpaceTop, (uintptr_t)_survivorSpaceTop)) {
lastFreeEntrySize = 0;
Expand All @@ -555,30 +555,27 @@ MM_MemorySubSpaceSemiSpace::flip(MM_EnvironmentBase *env, Flip_step step)
/* Region size is aligned to Concurrent Scavenger Page Section size already */
heapAlignedLastFreeEntrySize = MM_Math::roundToFloor(_extensions->regionSize, heapAlignedLastFreeEntrySize);

if (debug) {
omrtty_printf("tilt restore_tilt_after_percolate heapAlignedLastFreeEntry %llx section (%llx) aligned size %llx\n",
lastFreeEntrySize, _extensions->getConcurrentScavengerPageSectionSize(), heapAlignedLastFreeEntrySize);
}

Trc_MM_MSSSS_flip_restore_tilt_after_percolate_with_stats(
env->getLanguageVMThread(),
lastFreeEntrySize,
_extensions->getConcurrentScavengerPageSectionSize(),
heapAlignedLastFreeEntrySize);
/* allocate/survivor base/top still hold the values from before when we did 100% tilt */
uintptr_t allocateSize = (uintptr_t)_allocateSpaceTop - (uintptr_t)_allocateSpaceBase;
uintptr_t survivorSize = (uintptr_t)_survivorSpaceTop - (uintptr_t)_survivorSpaceBase;
if (allocateSize < survivorSize) {
allocateSize = survivorSize;
survivorSize = (uintptr_t)_allocateSpaceTop - (uintptr_t)_allocateSpaceBase;
}

if (debug) {
omrtty_printf("tilt restore_tilt_after_percolate allocateSize %llx survivorSize %llx\n", allocateSize, survivorSize);
}
Trc_MM_MSSSS_flip_restore_tilt_after_percolate_current_status(
env->getLanguageVMThread(), "", allocateSize, survivorSize);
if (heapAlignedLastFreeEntrySize < survivorSize) {
allocateSize += (survivorSize - heapAlignedLastFreeEntrySize);
survivorSize = heapAlignedLastFreeEntrySize;
}
if (debug) {
omrtty_printf("tilt restore_tilt_after_percolate adjusted allocateSize %llx survivorSize %llx\n", allocateSize, survivorSize);
}

Trc_MM_MSSSS_flip_restore_tilt_after_percolate_current_status(
env->getLanguageVMThread(), "adjusted ",
allocateSize, survivorSize);
tilt(env, allocateSize, survivorSize);

/* Restore allocation, which we had disabled in the backout step */
Expand Down
6 changes: 6 additions & 0 deletions gc/base/j9mm.tdf
Original file line number Diff line number Diff line change
Expand Up @@ -1019,3 +1019,9 @@ TraceException=Trc_MM_ParallelDispatcher_internalStartupThreads_Failed noEnv Ove

TraceExit=Trc_MM_MemorySubSpaceUniSpace_timeForHeapContract_Exit8 Overhead=1 Level=1 Group=resize Template="MM_MemorySubSpace_timeForHeapContract Exit8 Heap cannot contract in implicit aggressive GC"
TraceExit=Trc_MM_MemorySubSpaceUniSpace_timeForHeapContract_Exit9 Overhead=1 Level=1 Group=resize Template="MM_MemorySubSpace_timeForHeapContract Exit9 Contraction required due to SoftMX request, size = %zu bytes"

TraceEvent=Trc_MM_MSSSS_flip_step Overhead=1 Level=1 Group=scavenge Template="MSSSS::flip %s"
TraceEvent=Trc_MM_MSSSS_flip_backout Overhead=1 Level=1 Group=scavenger Template="MSSSS::flip backout %s_allocateSpaceBase/Top %zx/%zx _survivorSpaceBase/Top %zx/%zx sizes %zu %zu"
TraceEvent=Trc_MM_MSSSS_flip_restore_tilt_after_percolate Overhead=1 Level=1 Group=scavenger Template="MSSSS::flip restore_tilt_after_percolate last free entry %zx size %zu"
TraceEvent=Trc_MM_MSSSS_flip_restore_tilt_after_percolate_with_stats Overhead=1 Level=1 Group=scavenge Template="MSSSS::flip restore_tilt_after_percolate heapAlignedLastFreeEntry %zu section (%zu) aligned size %zu"
TraceEvent=Trc_MM_MSSSS_flip_restore_tilt_after_percolate_current_status Overhead=1 Level=1 Group=scavenge Template="MSSSS::flip restore_tilt_after_percolate %sallocateSize %zu survivorSize %zu"

0 comments on commit 43a2b1d

Please sign in to comment.