RFR: 8140326: G1: Consider putting regions where evacuation failed into next collection set [v7]
Thomas Schatzl
tschatzl at openjdk.org
Fri Jun 30 08:44:05 UTC 2023
> This change adds management of retained regions, i.e. trying to evacuate evacuation failed regions asap.
>
> The advantage is that evacuation failed regions do not need to wait until the next marking to be cleaned out; as they are often very sparsely occupied (often being eden regions), this occupies a lot of space, potentially causing additional evacuation failures later on.
> Another use of this change will be region pinning, which are basically evacuation failed regions that can not be reclaimed as long as they are pinned - however as soon as they are unpinned, they should be reclaimed for the same reasons as well.
>
> It consists of several behavioral changes:
>
> During garbage collection:
>
> ... in the Evacuation phase:
> * always collect dirty cards into evacuation failed regions proactively. In tests, the amount of cards/live objects per evacuation failed region is typically very small. Dirty cards are always put into the global refinement buffer immediately, assuming that we will keep most if not all evacuation failed regions.
>
> ... during Post Evacuation 2/Free Collection Set phase:
> * determine whether the region will be retained (kept for "immediate" evacuation) or not. Highly occupied regions are assumed to stay (mostly) live at least until the next marking, so do not bother with them.
>
> These "retained" regions are collected in a new "from retained" set in the collection set candidates and managed separately from "from marking" regions. Having the "from retained" and "from marking" sets separate in the collection set candidates is easier to manage than to use a single list and the picking stuff from it. Particularly wrt to making sure that mixed gcs preferentially pick from the "from marking" list first, then second from the "from retained" list.
>
> ... determining the collection set during the pause:
> * during gc, the collection set is preferentially (first) populated with regions from the "from marking" candidates (these are the important regions to get cleaned out), second from the "from retained" list.
> * g1 reserves up to 20% of max gc pause time for retained regions as optional candidates (this is a random number) to make sure that these are cleared out asap to free memory. There is also a minimum number of regions to take from the retained regions list.
>
> During marking
>
> ... changes to marking proper
> * retained regions will not be marked through during concurrent mark, i.e. they are considered outside of the snapshot. So they are added to the "root regio...
Thomas Schatzl has updated the pull request incrementally with one additional commit since the last revision:
ayang review3
- More documentation
- some renames
- also exclude collection set regions from initial TAMS update as it is likely they will not fail evacuation
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/14220/files
- new: https://git.openjdk.org/jdk/pull/14220/files/2bb1fdaa..901edcbd
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=14220&range=06
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=14220&range=05-06
Stats: 16 lines in 5 files changed: 5 ins; 0 del; 11 mod
Patch: https://git.openjdk.org/jdk/pull/14220.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/14220/head:pull/14220
PR: https://git.openjdk.org/jdk/pull/14220
More information about the hotspot-gc-dev
mailing list