8264987: G1: Fill BOTs for Survivor-turned-to-Old regions in full gc

Co-authored-by: Shoubing Ma <mashoubing1@huawei.com>
Reviewed-by: tschatzl, sjohanss
This commit is contained in:
Hamlin Li 2021-04-16 08:07:00 +00:00
parent fc89fe6458
commit b4ba74e3ac
2 changed files with 24 additions and 1 deletions

View File

@ -63,10 +63,16 @@ bool G1FullGCPrepareTask::G1CalculatePointersClosure::do_heap_region(HeapRegion*
} else {
assert(MarkSweepDeadRatio > 0,
"only skip compaction for other regions when MarkSweepDeadRatio > 0");
// Force the high live ratio region as compacting to skip these regions in the
// later compaction step.
force_not_compacted = true;
if (hr->is_young()) {
// G1 updates the BOT for old region contents incrementally, but young regions
// lack BOT information for performance reasons.
// Recreate BOT information of high live ratio young regions here to keep expected
// performance during scanning their card tables in the collection pauses later.
update_bot(hr);
}
log_debug(gc, phases)("Phase 2: skip compaction region index: %u, live words: " SIZE_FORMAT,
hr->hrm_index(), _collector->live_words(hr->hrm_index()));
}
@ -157,6 +163,22 @@ bool G1FullGCPrepareTask::G1CalculatePointersClosure::should_compact(HeapRegion*
return live_words <= live_words_threshold;
}
void G1FullGCPrepareTask::G1CalculatePointersClosure::update_bot(HeapRegion* hr) {
HeapWord* const limit = hr->top();
HeapWord* next_addr = hr->bottom();
HeapWord* threshold = hr->initialize_threshold();
HeapWord* prev_addr;
while (next_addr < limit) {
prev_addr = next_addr;
next_addr = _bitmap->get_next_marked_addr(next_addr + 1, limit);
if (next_addr > threshold) {
threshold = hr->cross_threshold(prev_addr, next_addr);
}
}
assert(next_addr == limit, "Should stop the scan at the limit.");
}
void G1FullGCPrepareTask::G1CalculatePointersClosure::reset_region_metadata(HeapRegion* hr) {
hr->rem_set()->clear();
hr->clear_cardtable();

View File

@ -63,6 +63,7 @@ protected:
void prepare_for_compaction_work(G1FullGCCompactionPoint* cp, HeapRegion* hr);
void free_humongous_region(HeapRegion* hr);
void free_open_archive_region(HeapRegion* hr);
void update_bot(HeapRegion* hr);
void reset_region_metadata(HeapRegion* hr);