RFR: 8276098: Do precise BOT updates in G1 evacuation phase

Stefan Johansson sjohanss at openjdk.java.net
Mon Nov 1 09:34:11 UTC 2021

On Mon, 1 Nov 2021 06:22:51 GMT, Yude Lin <duke at openjdk.java.net> wrote:

>> Please review this change to do precise BOT updates in the G1 evacuation phase.
>> **Summary**
>> In G1 young collections the BOT is updated for objects copied to old generation regions. Prior to this fix the BOT updates are very crude and only done for each new PLAB and for direct allocations (large allocation outside the PLABs).
>> The BOT is then updated to be more precise during concurrent refinement and when scanning the heap in later GCs. This leads to both more time spent doing concurrent refinement as well as prolonged "scan heap" phases in the following GCs.
>> With this change we instead update the BOT to be complete and precise while doing the copy. This way we can reduce the time in the following phases quite significantly. This comes with a slight regression in object copy times, but from my measurements the overall gain is worth the complexity and extra time spent in object copy. 
>> Doing this more precise BOT updating requires us to not rely on a global threshold for updating the BOT but instead calculate where the updates are done, this allows us to remove a lock in the old generation allocation path which is only present to guard this threshold. So with this change we can remove the different allocation paths used for young and old regions.
>> **Testing**
>> All testing look good:
>> - [x] Mach5 tier1-5
>> - [x] Local stress testing
>> - [x] Performance testing and pause time comparisons
> src/hotspot/share/gc/g1/g1AllocRegion.cpp line 58:
>> 56:   _alloc_region->update_bot_at(addr, size);
>> 57: }
>> 58: 
> May I ask why do we need to update for the filler objects? Because we are not scanning them.

Good question. You are correct in that we never need to scan these parts because of dirty cards, but during remembered set rebuilding (_see_: `G1RebuildRemSetHeapRegionClosure::rebuild_rem_set_in_region(...)`) we include the whole region when looking for references to other heap regions. 

There might be some good way to avoid scanning those parts during rebuild, but such investigation is out of scope for this PR.

Thanks for reviewing 😄


PR: https://git.openjdk.java.net/jdk/pull/6166

More information about the hotspot-gc-dev mailing list