Skip to content

Commit

Permalink
Do the mark information reset more fine grained (like before this cha…
Browse files Browse the repository at this point in the history
…nge) to not potentially make HeapRegion::hr_clear() too slow
  • Loading branch information
Thomas Schatzl committed Mar 6, 2024
1 parent e6f3d2e commit 0c551e9
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
12 changes: 11 additions & 1 deletion src/hotspot/share/gc/g1/g1ConcurrentMark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,6 @@ void G1ConcurrentMark::clear_statistics(HeapRegion* r) {
for (uint j = 0; j < _max_num_tasks; ++j) {
_tasks[j]->clear_mark_stats_cache(region_idx);
}
_top_at_mark_starts[region_idx] = _g1h->bottom_addr_for_region(region_idx);
_top_at_rebuild_starts[region_idx] = nullptr;
_region_mark_stats[region_idx].clear();
}
Expand All @@ -586,6 +585,16 @@ void G1ConcurrentMark::humongous_object_eagerly_reclaimed(HeapRegion* r) {

// Need to clear mark bit of the humongous object. Doing this unconditionally is fine.
mark_bitmap()->clear(r->bottom());

if (!_g1h->collector_state()->mark_or_rebuild_in_progress()) {
return;
}

// Clear any statistics about the region gathered so far.
_g1h->humongous_obj_regions_iterate(r,
[&] (HeapRegion* r) {
clear_statistics(r);
});
}

void G1ConcurrentMark::reset_marking_for_restart() {
Expand Down Expand Up @@ -1465,6 +1474,7 @@ class G1ReclaimEmptyRegionsTask : public WorkerTask {
_g1h->free_region(hr, _local_cleanup_list);
}
hr->clear_cardtable();
_g1h->concurrent_mark()->clear_statistics(hr);
}

return false;
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/g1/g1HeapRegion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ void HeapRegion::hr_clear(bool clear_space) {

rem_set()->clear();

G1CollectedHeap::heap()->concurrent_mark()->clear_statistics(this);
G1CollectedHeap::heap()->concurrent_mark()->reset_top_at_mark_start(this);

_parsable_bottom = bottom();
_garbage_bytes = 0;
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/gc/g1/g1HeapRegion.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,9 @@ inline void HeapRegion::reset_skip_compacting_after_full_gc() {
}

inline void HeapRegion::reset_after_full_gc_common() {
// After a full gc the mark bitmap in a movable region is invalid. Reset marking
// After a full gc the mark information in a movable region is invalid. Reset marking
// information.
G1CollectedHeap::heap()->concurrent_mark()->clear_statistics(this); // FIXME?
G1CollectedHeap::heap()->concurrent_mark()->reset_top_at_mark_start(this);

// Everything above bottom() is parsable and live.
reset_parsable_bottom();
Expand Down
1 change: 1 addition & 0 deletions src/hotspot/share/gc/g1/g1RemSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1133,6 +1133,7 @@ class G1MergeHeapRootsTask : public WorkerTask {
// so the bitmap for the regions in the collection set must be cleared if not already.
if (should_clear_region(hr)) {
_g1h->clear_bitmap_for_region(hr);
_g1h->concurrent_mark()->reset_top_at_mark_start(hr);
} else {
assert_bitmap_clear(hr, _g1h->concurrent_mark()->mark_bitmap());
}
Expand Down
1 change: 0 additions & 1 deletion src/hotspot/share/gc/g1/g1YoungGCPostEvacuateTasks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,6 @@ class G1PostEvacuateCollectionSetCleanupTask2::ProcessEvacuationFailedRegionsTas
bool clear_mark_data = !g1h->collector_state()->in_concurrent_start_gc() ||
g1h->policy()->should_retain_evac_failed_region(r);

cm->clear_statistics(r);
if (clear_mark_data) {
g1h->clear_bitmap_for_region(r);
} else {
Expand Down

0 comments on commit 0c551e9

Please sign in to comment.