Skip to content

Commit 0c551e9

Browse files
author
Thomas Schatzl
committed
Do the mark information reset more fine grained (like before this change) to not potentially make HeapRegion::hr_clear() too slow
1 parent e6f3d2e commit 0c551e9

File tree

5 files changed

+15
-5
lines changed

5 files changed

+15
-5
lines changed

src/hotspot/share/gc/g1/g1ConcurrentMark.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,6 @@ void G1ConcurrentMark::clear_statistics(HeapRegion* r) {
575575
for (uint j = 0; j < _max_num_tasks; ++j) {
576576
_tasks[j]->clear_mark_stats_cache(region_idx);
577577
}
578-
_top_at_mark_starts[region_idx] = _g1h->bottom_addr_for_region(region_idx);
579578
_top_at_rebuild_starts[region_idx] = nullptr;
580579
_region_mark_stats[region_idx].clear();
581580
}
@@ -586,6 +585,16 @@ void G1ConcurrentMark::humongous_object_eagerly_reclaimed(HeapRegion* r) {
586585

587586
// Need to clear mark bit of the humongous object. Doing this unconditionally is fine.
588587
mark_bitmap()->clear(r->bottom());
588+
589+
if (!_g1h->collector_state()->mark_or_rebuild_in_progress()) {
590+
return;
591+
}
592+
593+
// Clear any statistics about the region gathered so far.
594+
_g1h->humongous_obj_regions_iterate(r,
595+
[&] (HeapRegion* r) {
596+
clear_statistics(r);
597+
});
589598
}
590599

591600
void G1ConcurrentMark::reset_marking_for_restart() {
@@ -1465,6 +1474,7 @@ class G1ReclaimEmptyRegionsTask : public WorkerTask {
14651474
_g1h->free_region(hr, _local_cleanup_list);
14661475
}
14671476
hr->clear_cardtable();
1477+
_g1h->concurrent_mark()->clear_statistics(hr);
14681478
}
14691479

14701480
return false;

src/hotspot/share/gc/g1/g1HeapRegion.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ void HeapRegion::hr_clear(bool clear_space) {
124124

125125
rem_set()->clear();
126126

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

129129
_parsable_bottom = bottom();
130130
_garbage_bytes = 0;

src/hotspot/share/gc/g1/g1HeapRegion.inline.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,9 @@ inline void HeapRegion::reset_skip_compacting_after_full_gc() {
187187
}
188188

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

194194
// Everything above bottom() is parsable and live.
195195
reset_parsable_bottom();

src/hotspot/share/gc/g1/g1RemSet.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,6 +1133,7 @@ class G1MergeHeapRootsTask : public WorkerTask {
11331133
// so the bitmap for the regions in the collection set must be cleared if not already.
11341134
if (should_clear_region(hr)) {
11351135
_g1h->clear_bitmap_for_region(hr);
1136+
_g1h->concurrent_mark()->reset_top_at_mark_start(hr);
11361137
} else {
11371138
assert_bitmap_clear(hr, _g1h->concurrent_mark()->mark_bitmap());
11381139
}

src/hotspot/share/gc/g1/g1YoungGCPostEvacuateTasks.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,6 @@ class G1PostEvacuateCollectionSetCleanupTask2::ProcessEvacuationFailedRegionsTas
555555
bool clear_mark_data = !g1h->collector_state()->in_concurrent_start_gc() ||
556556
g1h->policy()->should_retain_evac_failed_region(r);
557557

558-
cm->clear_statistics(r);
559558
if (clear_mark_data) {
560559
g1h->clear_bitmap_for_region(r);
561560
} else {

0 commit comments

Comments
 (0)