RFR: Enforce max regions

William Kemper wkemper at openjdk.org
Tue Dec 6 21:35:11 UTC 2022


On Tue, 6 Dec 2022 17:57:18 GMT, Kelvin Nilsen <kdnilsen at openjdk.org> wrote:

> This commit enforces upper bounds on the number of ShenandoahHeapRegions affiliated with each generation.  Prior to this change, enforcement of generation sizes was by usage alone.  This allowed situations in which so many sparsely populated regions were affiliated with old-gen that there were insufficient FREE regions available to satisfy legitimate young-gen allocation requests.  This was resulting in excessive TLAB allocation failures and degenerated collections.

I saw a pattern like this in a couple of a places for young and old generations:

size_t avail_young_regions = ((_heap->young_generation()->adjusted_capacity() - _heap->young_generation()->used_regions_size())
                                / ShenandoahHeapRegion::region_size_bytes());

We also have this method in `ShenandoahGeneration` called `free_unaffiliated_regions` which is similar, except that it uses soft max capacity, instead of adjusted capacity. Could these calculations be consolidated?

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

PR: https://git.openjdk.org/shenandoah/pull/179


More information about the shenandoah-dev mailing list