Integrated: 8314573: G1: Heap resizing at Remark does not take existing eden regions into account

Thomas Schatzl tschatzl at openjdk.org
Tue Aug 29 14:23:19 UTC 2023


On Wed, 23 Aug 2023 09:54:41 GMT, Thomas Schatzl <tschatzl at openjdk.org> wrote:

> Hi all,
> 
>   can I have reviews for this change that tries to make the heap resizing policy at Remark more similar to the one after full GC?
> 
> The problem is that when calculating the amount of free regions to apply the Min/MaxHeapFreeRatio during Remark g1 does not consider that at Remark we might have already allocated lots of eden regions.
> Which means that the heap appears fuller than it would be during full gc, which means that Remark sometimes expands very aggressively due to MinHeapFreeRatio setting. I.e. if at the time of remark pause free regions 
> 
> There should be no impact wrt to shrinking: MaxHeapFreeRatio is by default (70%) larger than the maximum eden/young gen size (G1MaxNewSizePercent = 60%), so there should be no additional shrinking (that would only lead to additional heap expansion later).
> 
> I am aware that fiddling with the values (MaxHeapFreeRatio/G1MaxNewSizePercent) may create a situation where g1 would immediately increase the heap afterwards due to young gen being able to be larger than MaxHeapFreeRatio (if G1MaxNewSizePercent > MaxHeapFreeRatio and G1 would use that large young gen). However this is no different to the current situation after full gc, so I would like to keep it as is. Also for the sake of not complicating this (imo) straightforward change.
> 
> A more comprehensive improvement to the problem would be [JDK-8238687](https://bugs.openjdk.org/browse/JDK-8238687), where we do the resizing when eden is empty after young gc, but I think this is out of scope here: this fix improves the situation recently reported to me where g1 suddenly started to expand a lot during Remark after upgrades, and should also fix the issue reported in https://bugs.openjdk.org/browse/JDK-6490394 in the last comment (which has been reported around 1 year after the push, which means likely it got overlooked).
> 
> Testing: tier1-3, internal perf testing with no changes
> 
> Thanks,
>   Thomas

This pull request has now been integrated.

Changeset: 762b6529
Author:    Thomas Schatzl <tschatzl at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/762b652912939b37fbd68955617705c62b9fc3a5
Stats:     8 lines in 1 file changed: 7 ins; 0 del; 1 mod

8314573: G1: Heap resizing at Remark does not take existing eden regions into account

Reviewed-by: kbarrett, ayang

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

PR: https://git.openjdk.org/jdk/pull/15400


More information about the hotspot-gc-dev mailing list