RFR: Allow young collection to suspend marking in old generation [v2]
Zhengyu Gu
zgu at openjdk.java.net
Mon Feb 22 18:17:01 UTC 2021
On Mon, 22 Feb 2021 17:37:28 GMT, earthling-amzn <github.com+71722661+earthling-amzn at openjdk.org> wrote:
>> **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.
>
> earthling-amzn has updated the pull request incrementally with two additional commits since the last revision:
>
> - Merge pull request #1 from rkennke/genshen-milestone-7
>
> Some fixes to make non-generational tests pass
> - Some fixes to make non-generational tests pass
Quick scan
src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp line 695:
> 693: static uint object_age(oop obj);
> 694:
> 695: static void increase_object_age(oop obj, uint additional_age);
Make it inlineable, maybe?
src/hotspot/cpu/aarch64/gc/shenandoah/shenandoahBarrierSetAssembler_aarch64.cpp line 384:
> 382: assert(bs->kind() == BarrierSet::ShenandoahBarrierSet, "Wrong barrier set kind");
> 383:
> 384: ShenandoahBarrierSet* ctbs = barrier_set_cast<ShenandoahBarrierSet>(bs);
Use ShenandoahBarrierSet::barrier_set() instead
src/hotspot/cpu/aarch64/gc/shenandoah/shenandoahBarrierSetAssembler_aarch64.cpp line 377:
> 375: }
> 376:
> 377: void ShenandoahBarrierSetAssembler::store_check(MacroAssembler* masm, Register obj, Address dst) {
dst param is not used
src/hotspot/cpu/aarch64/gc/shenandoah/shenandoahBarrierSetAssembler_aarch64.cpp line 395:
> 393: if (UseCondCardMark) {
> 394: Label L_already_dirty;
> 395: __ membar(Assembler::StoreLoad);
Should be able to move down the barrier just before the store and avoid it if card already dirt, right?
src/hotspot/cpu/aarch64/gc/shenandoah/c1/shenandoahBarrierSetC1_aarch64.cpp line 92:
> 90: __ append(new LIR_OpShenandoahCompareAndSwap(addr, cmp_value.result(), new_value.result(), t1, t2, result));
> 91:
> 92: if (access.is_oop()) {
Redundant check
src/hotspot/cpu/x86/gc/shenandoah/c1/shenandoahBarrierSetC1_x86.cpp line 91:
> 89: __ append(new LIR_OpShenandoahCompareAndSwap(addr, cmp_value.result(), new_value.result(), t1, t2, result));
> 90:
> 91: if (access.is_oop()) {
Redundant check
src/hotspot/share/gc/shenandoah/c1/shenandoahBarrierSetC1.cpp line 373:
> 371: }
> 372: }
> 373:
Superfluous newline
-------------
Changes requested by zgu (Reviewer).
PR: https://git.openjdk.java.net/shenandoah/pull/19
More information about the shenandoah-dev
mailing list