RFR: 8331048: G1: Prune rebuild candidates based on G1HeapWastePercent early

Thomas Schatzl tschatzl at openjdk.org
Fri Apr 26 11:56:34 UTC 2024


On Fri, 26 Apr 2024 10:07:55 GMT, Ivan Walulya <iwalulya at openjdk.org> wrote:

> Hi, 
> 
> Please review this change that moves the `G1CollectionSetChooser::build` out of the cleanup pause into the remark pause. This prunes the rebuild candidates based on G1HeapWastePercent, thereby reducing the rebuild time in cases where pruning happens. 
> 
> Testing: Tier 1 - 5
> 
> ![concurrent_rebuild](https://github.com/openjdk/jdk/assets/69453999/b14dd9d7-24e7-43ed-bf0f-5d3030d9180f)

Changes requested by tschatzl (Reviewer).

src/hotspot/share/gc/g1/g1ConcurrentMark.cpp line 1446:

> 1444:       // Prune rebuild candidates based on G1HeapWastePercent.
> 1445:       // Improves rebuild time in addition to remembered set memory usage.
> 1446:       G1CollectionSetChooser::build(_g1h->workers(), _g1h->num_regions(), _g1h->policy()->candidates());

The `build` method sorts according to gc efficiency and prunes.

GC efficiency can not be properly determined at this point and is entirely based on occupancy (remsets are empty); so basically what this does is sort and prune by live objects.

The whole gc-efficiency calculation can then be removed.

Actually I am not sure making the efficiency only based on free space is problematic, however we shouldn't pretend we care then.

An alternative I tried long time ago has been counting incoming references during marking as a substitute for the remset size metric. However in reality, the remembered set is a metric based on cards, so it will potentially be hard to assign cost for remembered set processing based on incoming references.

src/hotspot/share/gc/g1/g1ConcurrentMark.cpp line 1448:

> 1446:       G1CollectionSetChooser::build(_g1h->workers(), _g1h->num_regions(), _g1h->policy()->candidates());
> 1447:     }
> 1448: 

I would prefer to put this block into above block so that it is part of the "Select For Rebuild and Reclaim Empty Regions" measurement.

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

PR Review: https://git.openjdk.org/jdk/pull/18970#pullrequestreview-2024794753
PR Review Comment: https://git.openjdk.org/jdk/pull/18970#discussion_r1580918714
PR Review Comment: https://git.openjdk.org/jdk/pull/18970#discussion_r1580875217


More information about the hotspot-gc-dev mailing list