RFR: 8276098: Do precise BOT updates in G1 evacuation phase [v2]

Thomas Schatzl tschatzl at openjdk.java.net
Mon Nov 8 13:43:39 UTC 2021


On Mon, 8 Nov 2021 13:29:07 GMT, Stefan Johansson <sjohanss at openjdk.org> 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
>
> Stefan Johansson has updated the pull request incrementally with four additional commits since the last revision:
> 
>  - Move BOT info into PLAB
>  - Predicate for needs_bot_update
>  - Rename allocate_no_bot_updates
>  - Handle waste when filling in dummy objects

Lgtm. Some minor naming/method location suggestions.

src/hotspot/share/gc/g1/g1Allocator.hpp line 221:

> 219: 
> 220:   // Update the BOT for the last PLAB allocation.
> 221:   inline void update_bot_for_allocation(G1HeapRegionAttr dest, size_t word_sz, uint node_index);

Suggestion:

  inline void update_bot_for_allocation(G1HeapRegionAttr dest, size_t word_sz, uint node_index);

Suggestion:

  inline void update_bot_for_plab_allocation(G1HeapRegionAttr dest, size_t word_sz, uint node_index);


I would explicitly call this out as to be used for PLAB allocation. If changed, obviously needs updates to the callers as well.

src/hotspot/share/gc/g1/g1HeapRegionAttr.hpp line 106:

> 104:   bool is_old() const                  { return type() == Old; }
> 105:   bool is_optional() const             { return type() == Optional; }
> 106:   bool needs_bot_update() const        { return is_old(); }

Not sure if that predicate needs to be here, I'd probably just add a method to `G1PLABAllocator`. But it is fine to me.

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

Marked as reviewed by tschatzl (Reviewer).

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


More information about the hotspot-gc-dev mailing list