RFR: Coalesce and fill old, pinned regions after old gen final mark

William Kemper wkemper at openjdk.org
Tue Jul 5 22:20:01 UTC 2022


On Tue, 5 Jul 2022 20:31:03 GMT, Y. Srinivas Ramakrishna <ysr at openjdk.org> wrote:

>> Pinned regions were not being coalesced and filled. This fixes a crash observed with the specjbb 2015 benchmark.
>
> src/hotspot/share/gc/shenandoah/heuristics/shenandoahOldHeuristics.cpp line 215:
> 
>> 213:         region->begin_preemptible_coalesce_and_fill();
>> 214:         candidates[cand_idx]._region = region;
>> 215:         candidates[cand_idx]._garbage = 0;
> 
> Newbie question:
> 
> Assume that the object gets unpinned prior to the next marking, and assume hypothetically that the region in question had mostly garbage (let's pick 99% garbage for the sake of argument). At region unpinning, do we sort it into the right position of the garbage first list after recomputing its garbage field?
> 
> In other words, I am wondering if we make the `_garbage` field indicate the correct value, but skip adding a pinned region to the collection set when the collection set is built? It looks like the protocol for meaning of the state `_cset_pinned`already accounts for regions being in the collection set while being pinned, so won't that protocol handle this already without having to sort pinned regions to the bottom of the garbage-first list or avoiding adding them to the collection set?

Those are good questions and I thought about letting the pinned region sort naturally on the amount of actual garbage, but I rejected that for two reasons:
* Shenandoah only updates the pin/unpinned status during a collection cycle. Once we have "candidates" for mixed collection, we won't run another old cycle before mixed collections are complete. This behavior could be changed, but it would be a much bigger change.
* It's critical that we fill in the dead objects for regions that are not candidates for mixed collections. The remembered set scan will use the mark bit map to avoid dead objects only _while_ there are mixed collection candidates. We could make a change to fill dead objects when pinned regions are rejected from the mixed collection set, but that would add complexity to the mixed collection cycle. Sorting the pinned regions as though they had no garbage lumps them in nicely with other regions that need to be filled.

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

PR: https://git.openjdk.org/shenandoah/pull/149


More information about the shenandoah-dev mailing list