-
Enhancement
-
Resolution: Fixed
-
P4
-
22
-
b26
From the PR:
The JEP covers the idea very well, so I'm only covering some implementation details here:
* regions get a "pin count" (reference count). As long as it is non-zero, we conservatively never reclaim that region even if there is no reference in there. JNI code might have references to it.
* the JNI spec only requires us to provide pinning support for typeArrays, nothing else. This implementation uses this in various ways:
* when evacuating from a pinned region, we evacuate everything live but the typeArrays to get more empty regions to clean up later.
* when formatting dead space within pinned regions we use filler objects. Pinned regions may be referenced by JNI code only, so we can't overwrite contents of any dead typeArray either. These dead but referenced typeArrays luckily have the same header size of our filler objects, so we can use their headers for our fillers. The problem is that previously there has been that restriction that filler objects are half a region size at most, so we can end up with the need for placing a filler object header inside a typeArray. The code could be clever and handle this situation by splitting the to be filled area so that this can't happen, but the solution taken here is allowing filler arrays to cover a whole region. They are not referenced by Java code anyway, so there is no harm in doing so (i.e. gc code never touches them anyway).
* G1 currently only ever actually evacuates young pinned regions. Old pinned regions of any kind are never put into the collection set and automatically skipped. However assuming that the pinning is of short length, we put them into the candidates when we can.
* there is the problem that if an applications pins a region for a long time g1 will skip evacuating that region over and over. that may lead to issues with the current policy in marking regions (only exit mixed phase when there are no marking candidates) and just waste of processing time (when the candidate stays in the retained candidates)
The cop-out chosen here is to "age out" the regions from the candidates and wait until the next marking happens.
I.e. pinned marking candidates are immediately moved to retained candidates, and if in total the region has been pinned for G1NumCollectionsKeepUnreclaimable collections it is dropped from the candidates. Its current value is fairly random.
G1 pauses got a new tag if there were pinned regions in the collection set. I.e. in addition to something like:
`GC(6) Pause Young (Normal) (Evacuation Failure) 1M->1M(22M) 36.16ms`
there is that new tag (Pinned) that indicates that one or more regions that were pinned were encountered during gc. E.g.
`GC(6) Pause Young (Normal) (Pinned) (Evacuation Failure) 1M->1M(22M) 36.16ms`
Pinned and Evacuation Failure tags are not exclusive. GC might have encountered both pinned regions and evacuation failed regions in the same collection or even in the same region.
- blocks
-
JDK-8319313 G1: Rename G1EvacFailureInjector appropriately
- Resolved
- duplicates
-
JDK-8310480 gc/cslocker/TestCSLocker.java times out with G1
- Closed
-
JDK-7005234 G1: Artificially reduce the TLAB size when expanding the eden due to the GC locker
- Closed
-
JDK-8194877 Clean up code in G1CollectedHeap::attempt_allocation_slow
- Closed
-
JDK-8228964 Improve G1 GCLocker allocation stall
- Closed
-
JDK-8236594 G1: Provide object pinning
- Closed
-
JDK-8278061 G1: Implement region pinning
- Closed
-
JDK-8278063 G1: Remove GCLocker usage and related code in G1
- Closed
-
JDK-8278285 G1: Distinguish logging between the real evac failure and region pinning
- Closed
- relates to
-
JDK-8323610 G1: HeapRegion pin count should be size_t to avoid overflows
- Resolved
-
JDK-8322484 22-b26 Regression in J2dBench-bimg_misc-G1 (and more) on Windows-x64 and macOS-x64
- Closed
-
JDK-8321422 Test gc/g1/pinnedobjs/TestPinnedObjectTypes.java times out after completion
- Resolved
-
JDK-8321369 Unproblemlist gc/cslocker/TestCSLocker.java
- Resolved
-
JDK-8331562 G1: Remove API to force allocation of new regions
- Resolved
-
JDK-8276094 JEP 423: Region Pinning for G1
- Closed