From abee5baeda173a808ce86f96fd9d9f5b062f661f Mon Sep 17 00:00:00 2001 From: Frank Kang Date: Wed, 27 Sep 2023 09:26:01 -0700 Subject: [PATCH] add more detailed comments --- runtime/gc_modron_startup/mminit.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/runtime/gc_modron_startup/mminit.cpp b/runtime/gc_modron_startup/mminit.cpp index f047a795329..8536f346f2d 100644 --- a/runtime/gc_modron_startup/mminit.cpp +++ b/runtime/gc_modron_startup/mminit.cpp @@ -3182,11 +3182,12 @@ gcReinitializeDefaultsForRestore(J9VMThread* vmThread) PORT_ACCESS_FROM_JAVAVM(vm); OMRPORT_ACCESS_FROM_J9PORT(PORTLIB); /* Note here we update this parameter which represents the machine physical memory, - * but not the original heap geometry from the snapshot run. We just force the heap - * not to go beyond a certain thereshold calculated based on the new (restore) memory - * availalibity through setting SoftMx. + * and we don't change the original heap geometry from snapshot run. */ extensions->usablePhysicalMemory = omrsysinfo_get_addressable_physical_memory(); + /* We re-use the softMx logic here to adjust default maximum heap size in restore path + * temporarily. + */ if (!extensions->userSpecifiedParameters._Xmx._wasSpecified){ uintptr_t candidateSoftMx = 0; /* if the user have set maxRAMPercent through -XX:MaxRAMPercentage */ @@ -3199,9 +3200,9 @@ gcReinitializeDefaultsForRestore(J9VMThread* vmThread) candidateSoftMx = extensions->computeDefaultMaxHeapForJava(false); } /* We will set softMx value only if maxHeap calculation returned us a smaller - * value than existing maxHeap or softMx values (or softMx isn't previously set), - * and set the softMx to be the maximum of -Xms (initial memory size) and the - * candidateSoftMx + * value than existing maxHeap or softMx values (or softMx isn't previously set). + * And set the softMx to be the maximum of -Xms (initial memory size) and the + * candidateSoftMx. */ if (extensions->memoryMax > candidateSoftMx) { if ((0 == extensions->softMx) || (extensions->softMx > candidateSoftMx)) {