There is some (seldom) executed code during merging the remembered set where G1 needs to clear the bitmap of old regions during GC.
The problem is that this clearing (and actually all other code executed in that G1ClearBitmapClosure) is not claimed by G1HeapRegion, i.e. every thread does that reset work for every region, duplicating work.
This is unnecessary - it is enough that a G1HeapRegion gets cleared once by whatever thread.
I.e. in this code in G1RemSet.cpp / G1MergeHeapRootsTask::work():
{
// 2. collection set
G1MergeCardSetClosure merge(_scan_state);
G1ClearBitmapClosure clear(g1h);
G1CombinedClosure combined(&merge, &clear);
if (_initial_evacuation) {
G1HeapRegionRemSet::iterate_for_merge(g1h->young_regions_cardset(), merge);
}
g1h->collection_set_iterate_increment_from(&combined, nullptr, worker_id);
Since that last call does not have a HeapRegionClaimer, G1ClearBitmapClosure is executed for every region for every thread. Note that the G1MergeCardSetClosure does internal claiming so it is not affected (i.e. does not do duplicate work).
Caused byJDK-8296954.
The problem is that this clearing (and actually all other code executed in that G1ClearBitmapClosure) is not claimed by G1HeapRegion, i.e. every thread does that reset work for every region, duplicating work.
This is unnecessary - it is enough that a G1HeapRegion gets cleared once by whatever thread.
I.e. in this code in G1RemSet.cpp / G1MergeHeapRootsTask::work():
{
// 2. collection set
G1MergeCardSetClosure merge(_scan_state);
G1ClearBitmapClosure clear(g1h);
G1CombinedClosure combined(&merge, &clear);
if (_initial_evacuation) {
G1HeapRegionRemSet::iterate_for_merge(g1h->young_regions_cardset(), merge);
}
g1h->collection_set_iterate_increment_from(&combined, nullptr, worker_id);
Since that last call does not have a HeapRegionClaimer, G1ClearBitmapClosure is executed for every region for every thread. Note that the G1MergeCardSetClosure does internal claiming so it is not affected (i.e. does not do duplicate work).
Caused by
- caused by
-
JDK-8296954 G1: Enable parallel scanning for heap region remset
-
- Resolved
-
- links to
-
Commit(master) openjdk/jdk/8e858294
-
Review(master) openjdk/jdk/23419