Skip to content
Permalink
Browse files
8278282: G1: Log basic statistics for evacuation failure
Reviewed-by: tschatzl, ayang, iwalulya
  • Loading branch information
Hamlin Li committed Jan 4, 2022
1 parent 1ffdc52 commit 93c7d90c55034ba8dbcd612366c891ad08c9c54e
@@ -28,6 +28,7 @@
#include "gc/g1/g1ConcurrentMark.inline.hpp"
#include "gc/g1/g1EvacFailure.hpp"
#include "gc/g1/g1EvacFailureRegions.hpp"
#include "gc/g1/g1GCPhaseTimes.hpp"
#include "gc/g1/g1HeapVerifier.hpp"
#include "gc/g1/g1OopClosures.inline.hpp"
#include "gc/g1/heapRegion.hpp"
@@ -146,12 +147,15 @@ class RemoveSelfForwardPtrHRClosure: public HeapRegionClosure {

G1EvacFailureRegions* _evac_failure_regions;

G1GCPhaseTimes* _phase_times;

public:
RemoveSelfForwardPtrHRClosure(uint worker_id,
G1EvacFailureRegions* evac_failure_regions) :
_g1h(G1CollectedHeap::heap()),
_worker_id(worker_id),
_evac_failure_regions(evac_failure_regions) {
_evac_failure_regions(evac_failure_regions),
_phase_times(G1CollectedHeap::heap()->phase_times()) {
}

size_t remove_self_forward_ptr_by_walking_hr(HeapRegion* hr,
@@ -185,6 +189,11 @@ class RemoveSelfForwardPtrHRClosure: public HeapRegionClosure {

hr->reset_bot();

_phase_times->record_or_add_thread_work_item(G1GCPhaseTimes::RestoreRetainedRegions,
_worker_id,
1,
G1GCPhaseTimes::RestoreRetainedRegionsNum);

size_t live_bytes = remove_self_forward_ptr_by_walking_hr(hr, during_concurrent_start);

hr->rem_set()->clean_strong_code_roots(hr);
@@ -102,7 +102,7 @@ G1GCPhaseTimes::G1GCPhaseTimes(STWGCTimer* gc_timer, uint max_gc_threads) :
_gc_par_phases[GCWorkerEnd] = new WorkerDataArray<double>("GCWorkerEnd", "GC Worker End (ms):", max_gc_threads);
_gc_par_phases[Other] = new WorkerDataArray<double>("Other", "GC Worker Other (ms):", max_gc_threads);
_gc_par_phases[MergePSS] = new WorkerDataArray<double>("MergePSS", "Merge Per-Thread State (ms):", max_gc_threads);
_gc_par_phases[RemoveSelfForwardingPtr] = new WorkerDataArray<double>("RemoveSelfForwardingPtr", "Remove Self Forwards (ms):", max_gc_threads);
_gc_par_phases[RestoreRetainedRegions] = new WorkerDataArray<double>("RestoreRetainedRegions", "Restore Retained Regions (ms):", max_gc_threads);
_gc_par_phases[ClearCardTable] = new WorkerDataArray<double>("ClearLoggedCards", "Clear Logged Cards (ms):", max_gc_threads);
_gc_par_phases[RecalculateUsed] = new WorkerDataArray<double>("RecalculateUsed", "Recalculate Used Memory (ms):", max_gc_threads);
_gc_par_phases[ResetHotCardCache] = new WorkerDataArray<double>("ResetHotCardCache", "Reset Hot Card Cache (ms):", max_gc_threads);
@@ -132,6 +132,8 @@ G1GCPhaseTimes::G1GCPhaseTimes(STWGCTimer* gc_timer, uint max_gc_threads) :
_gc_par_phases[MergePSS]->create_thread_work_items("LAB Waste", MergePSSLABWasteBytes);
_gc_par_phases[MergePSS]->create_thread_work_items("LAB Undo Waste", MergePSSLABUndoWasteBytes);

_gc_par_phases[RestoreRetainedRegions]->create_thread_work_items("Evacuation Failure Regions:", RestoreRetainedRegionsNum);

_gc_par_phases[EagerlyReclaimHumongousObjects]->create_thread_work_items("Humongous Total", EagerlyReclaimNumTotal);
_gc_par_phases[EagerlyReclaimHumongousObjects]->create_thread_work_items("Humongous Candidates", EagerlyReclaimNumCandidates);
_gc_par_phases[EagerlyReclaimHumongousObjects]->create_thread_work_items("Humongous Reclaimed", EagerlyReclaimNumReclaimed);
@@ -480,7 +482,7 @@ double G1GCPhaseTimes::print_post_evacuate_collection_set(bool evacuation_failed
debug_phase(_gc_par_phases[ClearCardTable], 1);
debug_phase(_gc_par_phases[RecalculateUsed], 1);
if (evacuation_failed) {
debug_phase(_gc_par_phases[RemoveSelfForwardingPtr], 1);
debug_phase(_gc_par_phases[RestoreRetainedRegions], 1);
}

trace_phase(_gc_par_phases[RedirtyCards]);
@@ -77,7 +77,7 @@ class G1GCPhaseTimes : public CHeapObj<mtGC> {
RebuildFreeList,
SampleCollectionSetCandidates,
MergePSS,
RemoveSelfForwardingPtr,
RestoreRetainedRegions,
ClearCardTable,
RecalculateUsed,
ResetHotCardCache,
@@ -144,6 +144,10 @@ class G1GCPhaseTimes : public CHeapObj<mtGC> {
MergePSSLABUndoWasteBytes
};

enum RestoreRetainedRegionsWorkItems {
RestoreRetainedRegionsNum,
};

enum GCEagerlyReclaimHumongousObjectsItems {
EagerlyReclaimNumTotal,
EagerlyReclaimNumCandidates,
@@ -103,7 +103,7 @@ class G1PostEvacuateCollectionSetCleanupTask1::RemoveSelfForwardPtrsTask : publi

public:
RemoveSelfForwardPtrsTask(G1EvacFailureRegions* evac_failure_regions) :
G1AbstractSubTask(G1GCPhaseTimes::RemoveSelfForwardingPtr),
G1AbstractSubTask(G1GCPhaseTimes::RestoreRetainedRegions),
_task(evac_failure_regions),
_evac_failure_regions(evac_failure_regions) { }

@@ -265,7 +265,8 @@ private void testConcurrentRefinementLogs() throws Exception {
LogMessageWithLevel exhFailureMessages[] = new LogMessageWithLevel[] {
new LogMessageWithLevel("Recalculate Used Memory", Level.DEBUG),
new LogMessageWithLevel("Restore Preserved Marks", Level.DEBUG),
new LogMessageWithLevel("Remove Self Forwards", Level.DEBUG),
new LogMessageWithLevel("Restore Retained Regions", Level.DEBUG),
new LogMessageWithLevel("Evacuation Failure Regions", Level.DEBUG),
};

private void testWithEvacuationFailureLogs() throws Exception {
@@ -126,7 +126,7 @@ public static void main(String[] args) throws IOException {
// since we can not reliably guarantee that they occur (or not).
Set<String> optPhases = of(
// The following two phases only occur on evacuation failure.
"RemoveSelfForwardingPtr",
"RestoreRetainedRegions",
"RestorePreservedMarks",

"OptScanHR",

1 comment on commit 93c7d90

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on 93c7d90 Jan 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.