RFR: Preempt old preparation

William Kemper wkemper at openjdk.java.net
Tue Oct 12 21:51:13 UTC 2021


On Tue, 12 Oct 2021 21:15:01 GMT, Kelvin Nilsen <kdnilsen at openjdk.org> wrote:

> Previously, all old-gen regions not selected as collection set candidates were "made parseable" during the final-mark safepoint.   Making each of these regions parseable involves coalescing consecutive unmarked objects into contiguous larger objects that contain no pointers.  The process of identifying each span of consecutive unmarked objects within a large number of large heap regions was found to require hundreds of ms in some cases.  This patch changes the behavior so that preparation of heap regions for subsequent evacuation is performed during a concurrent phase of operation.  This concurrent phase must complete before any of the old heap regions placed in the candidate collection set can be evacuated.

Changes requested by wkemper (Committer).

src/hotspot/share/gc/shenandoah/shenandoahConcurrentGC.cpp line 75:

> 73: };
> 74: 
> 75: class ShenandoahGlobalCoalesceAndFill : public ShenandoahHeapRegionClosure {

Not sure how this ended up `shenandoahConcurrentGC.cpp`, last I checked it was defined in `shenandoahHeap.cpp`.

src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp line 177:

> 175:     // Any OLD region allocated during concurrent coalesce-and-fill does not need to be coalesced and filled.
> 176:     // This code is only necessary if req.affiliation() is old, but harmless if not.
> 177:     r->finish_coalesce_and_fill(); 

Not sure I understand why that's the case. This region could still contain garbage objects that could break the remembered set scan. How does allocating out of the region make these objects parseable?

src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.cpp line 467:

> 465:       obj_addr = next_marked_obj;
> 466:     }
> 467:     if (!ops_before_preempt_check--) {

I think the `C++` way is to compare against 0, not coerce to bool.

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

PR: https://git.openjdk.java.net/shenandoah/pull/88


More information about the shenandoah-dev mailing list