RFR: 8336086: G1: Use one G1CardSet instance for all young regions

Albert Mingkun Yang ayang at openjdk.org
Mon Jul 22 19:46:37 UTC 2024


On Thu, 11 Jul 2024 09:45:37 GMT, Ivan Walulya <iwalulya at openjdk.org> wrote:

> Hi all,
> 
> Please review this change to assign a single G1CardSet to all young regions. As young regions are collected at the same, and we do not have young-to-young remembered sets, we can maintain a single G1CardSet for all young regions.
> 
> This reduces the memory overhead of the G1CardSets and the time taken to merge per region G1CardSets during GC pause.
> 
> Testing: Tier 1-5

src/hotspot/share/gc/g1/g1HeapRegionRemSet.hpp line 51:

> 49:   // The set of cards in the Java heap
> 50:   G1CardSet* _card_set;
> 51:   G1CardSet* _saved_card_set;

I think the reason for have *two* fields instead of one is that a region can go through old<->young transitions multiple times. A young-region uses the second field to save the card-set used when the same region become old. I wonder if this "detail" can be extracted out of remset, sth like an array of card-set pointers maintained outside of remset. IOW, it seems an abstraction leakage if remset knows there are two "kinds" of card-set.

src/hotspot/share/gc/g1/g1RemSetSummary.cpp line 227:

> 225:     size_t rs_mem_sz = hrrs->mem_size();
> 226: 
> 227:     if (r->is_young() && hrrs->has_group_cardset()) {

When do young-regions not have group cardset? (I thought the second condition would always be true if the first is met.)

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20134#discussion_r1687061728
PR Review Comment: https://git.openjdk.org/jdk/pull/20134#discussion_r1687056486


More information about the hotspot-gc-dev mailing list