RFR: 8302215: G1: Last-ditch Full GC should do serial compaction for tail regions in per thread compaction points. [v2]

Stefan Johansson sjohanss at openjdk.org
Wed Feb 15 15:09:48 UTC 2023


On Wed, 15 Feb 2023 11:26:42 GMT, Ivan Walulya <iwalulya at openjdk.org> wrote:

>> src/hotspot/share/gc/g1/g1FullCollector.cpp line 382:
>> 
>>> 380:   // point. To get maximum compaction and reduce fragmentation, we sort the regions
>>> 381:   // by hrm_index so that we compact objects to one end of the heap.
>>> 382:   serial_cp->sort_regions();
>> 
>> I think the intention can be made more explicit by adding higher-index regions to `serial_cp` in order, sth like:
>> 
>> 
>> for (w : workers) {
>>   w->cp->filter(< lowest_current_hr);
>> }
>> 
>> for i in [lowest_current_hr..max) {
>>   r = region_at(i);
>>   if r->is_pinned
>>     continue;
>>   serial_cp->add(i);
>> }
>
> I can add a comment if its unclear, however, redoing the filtering as above can be extremely unnecessary, especially where heap has very many pinned regions as in the test-case `vmTestbase/vm/gc/compact/Compact_InternedStrings_NonbranchyTree/TestDescription.java`. You have a few regions for serial compaction, and the sorting is sufficient.  So I would rather keep the current implementation.

An alternative, similar to what Albert suggests, would be to change `move_regions_with_higher_hrm_index(...)` to `remove_above(lowest_hr, bitmap)` and when removing the regions from the compaction point store what regions were in use in a bitmap. Then you could use that bitmap to add the regions in order to the serial compaction point.

-------------

PR: https://git.openjdk.org/jdk/pull/12529


More information about the hotspot-gc-dev mailing list