RFR: 8314573: G1: Heap resizing at Remark does not take existing eden regions into account
Thomas Schatzl
tschatzl at openjdk.org
Wed Aug 23 10:02:03 UTC 2023
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
-------------
Commit messages:
- initial version
Changes: https://git.openjdk.org/jdk/pull/15400/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=15400&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8314573
Stats: 8 lines in 1 file changed: 7 ins; 0 del; 1 mod
Patch: https://git.openjdk.org/jdk/pull/15400.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/15400/head:pull/15400
PR: https://git.openjdk.org/jdk/pull/15400
More information about the hotspot-gc-dev
mailing list