RFR: Allow young collection to suspend marking in old generation
earthling-amzn
github.com+71722661+earthling-amzn at openjdk.java.net
Sat Feb 20 00:39:08 UTC 2021
**This is a work in progress.**
## Summary of changes
The goal of these changes is to allow young cycles to suspend marking in the old generation. When the young cycle is complete, the concurrent old marking will resume.
* Evaluation of heuristics was pulled into a new `ShenandoahRegulatorThread`. Taking this evaluation out of line from the control thread allows the regulator to suspend (using the cancellation mechanism) old generation marking and start a young generation cycle.
* Task queues for marking have been moved from `ShenandoahMarkingContext` into `ShenandoahGeneration`. This allows the marking state for the old generation to persist across young generation cycles. The associated `is_complete` state has also been moved to `ShenandoahGeneration`.
* Old generation marking is bootstrapped by a complete young generation cycle. In this scenario, the mark closures for a young cycle are given reference to the young generation mark queues _and_ the old generation mark queues. Rather than ignore old references as is done for a normal young cycle, they are enqueued in the old generation mark queues. When the young cycle completes, the old generation marking continues using the task queues primed by the preceding young cycle.
* There is a new flag: `ShenandoahAllowOldMarkingPreemption` (defaults to true). Disabling this option will cause the regulator to schedule `young` or `global` collects (according to heuristics), but will _not_ schedule `old` collects.
* The `global` generation is used to support satb and incremental-update modes. The `global` generation is also used for degenerated and implicit/explicit gc requests. Degenerated cycles are not working on this branch and the root cause is understood.
* The `global` generation is also used for `FullGC`, but this is also broken. The `FullGC` doesn't update the remembered set during compaction. We reckon there is a non-trivial amount of work to fix this.
* The `MARKING` gc state has been split into `YOUNG_MARKING` and `OLD_MARKING`.
* Immediate garbage collection is broken in generational mode. The update references phase is used to repair the remembered set, so when this phase is skipped the remembered set scan runs into trouble. A fix for this is in progress.
* The remembered set is scanned on a safepoint during initial mark. Work to make this concurrent is in progress.
-------------
Commit messages:
- Remove trailing whitespace
- Fix jcheck and compiler errors
- Allow young collection to suspend marking in old generation
Changes: https://git.openjdk.java.net/shenandoah/pull/19/files
Webrev: https://webrevs.openjdk.java.net/?repo=shenandoah&pr=19&range=00
Stats: 3775 lines in 90 files changed: 2788 ins; 516 del; 471 mod
Patch: https://git.openjdk.java.net/shenandoah/pull/19.diff
Fetch: git fetch https://git.openjdk.java.net/shenandoah pull/19/head:pull/19
PR: https://git.openjdk.java.net/shenandoah/pull/19
More information about the shenandoah-dev
mailing list