Skip to content

Commit

Permalink
8325857: G1 Full GC flushes mark stats cache too early
Browse files Browse the repository at this point in the history
Flush mark stats cache after reference processing because that phase can mark some objects.

Intentionally performed serially because even on not-so-current processors this phase takes < 1ms for up to 256 threads.
  • Loading branch information
Thomas Schatzl committed Feb 23, 2024
1 parent 68eb5a1 commit 449ea23
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/hotspot/share/gc/g1/g1FullCollector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,13 @@ void G1FullCollector::phase1_mark_live_objects() {
reference_processor()->set_active_mt_degree(old_active_mt_degree);
}

{
GCTraceTime(Debug, gc, phases) debug("Phase 1: Flush Mark Stats Cache", scope()->timer());
for (uint i = 0; i < workers(); i++) {
marker(i)->flush_mark_stats_cache();
}
}

// Weak oops cleanup.
{
GCTraceTime(Debug, gc, phases) debug("Phase 1: Weak Processing", scope()->timer());
Expand Down
1 change: 0 additions & 1 deletion src/hotspot/share/gc/g1/g1FullGCMarkTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ void G1FullGCMarkTask::work(uint worker_id) {

// Mark stack is populated, now process and drain it.
marker->complete_marking(collector()->oop_queue_set(), collector()->array_queue_set(), &_terminator);
marker->flush_mark_stats_cache();

// This is the point where the entire marking should have completed.
assert(marker->oop_stack()->is_empty(), "Marking should have completed");
Expand Down

0 comments on commit 449ea23

Please sign in to comment.