8262185: Some questions regarding prune collection set candidates early

Tianqi Xia txiadev at gmail.com
Mon May 9 14:25:34 UTC 2022


Hi,

I tried to backport and test this patch with JDK11 on my local machine.
After going through the code(in master branch), I had 2 minor questions
related to the implementation details.

1. Seems to me one of the pruning conditions is "we must keep at least
min_old_cset_length number of regions in the cset". The formula for
calculating min_old_cset_length is dividing the number of candidate regions
by G1MixedGCCountTarget. This calculation happens twice during GC, once in
this pruning logic, followed by the other one in finalizing the cset old
regions(G1Policy::calculate_old_collection_set_regions). After pruning, the
number of candidate regions will be decreased, which means the value of
min_old_cset_length calculated during calculate_old_collection_set_regions
will always be less than the one calculated during pruning, is that
intended?

2. The second question is about the following if statement in the
do_heap_region function of G1PruneRegionClosure:
    if (_num_pruned > _max_pruned ||
        _cur_wasted + reclaimable > _max_wasted) {
        return true;
    }
   Should it be _num_pruned >= _max_pruned? Seems like we should stop if we
have already pruned _max_pruned number of regions.

Thanks,
Tianqi



More information about the hotspot-gc-dev mailing list