Withdrawn: Introduce second mark bitmap to support remembered set scan

William Kemper wkemper at openjdk.java.net
Wed Sep 29 23:02:26 UTC 2021


On Mon, 21 Jun 2021 21:48:32 GMT, William Kemper <wkemper at openjdk.org> wrote:

> ## Motivation
> After final mark, Shenandoah chooses the collection set (regions that will be reclaimed). If there is a sufficient amount of reclaimable memory in regions that are 100% garbage, it recycles them immediately and skips the evacuation and update reference phases (there are no pointers into these 100% garbage regions). Note that in this case there are still dead objects in regions outside of the collection set. During subsequent remembered set scans, Shenandoah must safely iterate objects in regions of memory indicated by marked cards. Specifically, it must not attempt to iterate over oops in the dead objects outside the collection set. Prior to the changes in this review, Generational Shenandoah disarmed these dead objects by coalescing them and then overwriting them with filler objects during the update references phase. There are some drawbacks to this approach:
> 
> * Originally, Generational Shenandoah used the oopDesc::size API to compute the size of filler objects. This API uses the klass for the oop to provide the size. Since we were using the size method on dead oops, if there were no instances of the klass still alive it could be unloaded during weak root processing and the size method would fail. To prevent this issue, we disabled ClassUnloading. 
> * We now use the mark bitmap to compute the size of dead objects, but there is still a risk here: when young collections coalesce and fill dead objects during concurrent old generation marking, the mark bitmap is incomplete.
> * It forced us to go through evacuation and update reference phases for every cycle. Our tests (Dacapo) show that approximately 33% of collections (with the default settings) find enough pure garbage regions to complete without evacuations.
> * It forces the collector to perform work proportional to the amount of garbage outside the collection set (in the old generation). For performance reasons, the collector should avoid any work which is proportional to the amount of garbage.
> 
> ## Overview of Changes
> Rather than filling in dead objects to provide safety to the remembered set scan, the scan now uses the marking bit map to skip over dead objects. This leverages the work already completed during the marking phase and no longer requires any additional maintenance work during the update reference phase. There are, however, a few wrinkles to consider:
> 
> * The evacuation phase needs to update the mark bitmap. This essentially mimics the work currently done to register objects with the remembered set.
> * During concurrent old marking, the remembered set scan cannot rely on the mark bitmap for the old generation. For this reason, a second bitmap has been added. At the beginning of a concurrent old mark, the bitmaps are switched. During concurrent old marking, the remembered set scan will use the previous (i.e., stable) bitmap for determining object liveness.
> * Though not directly related to these changes, a fix for reference processing has been implemented in terms of these changes (i.e., the fix uses the secondary bitmap). Please note, the "fix" for reference processing is incorrect. It does not preserve the atomicity required when null'ing out references. Work on reference processing is proceeding on a separate branch, unrelated to these changes.
> 
> ## Remaining Work
> 
> * Object registration should no longer be necessary. We can use the mark bitmap to tell us if a card has any objects.
> * Shenandoah has an optimization to avoid clearing bitmap regions that are known to contain no marked bits. This optimization is currently disabled. It needs to be debugged (I think it is confused by extra marks made during evacuation).
> * Region promotions that happen during a concurrent old mark must copy the bitmap of the promoted region - this is currently done in a most inefficient way.

This pull request has been closed without being integrated.

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

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


More information about the shenandoah-dev mailing list