JDK-6994056 : G1: when GC locker is active, extend the Eden instead of allocating into the old gen
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: hs20
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2010-10-22
  • Updated: 2013-09-18
  • Resolved: 2011-04-23
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6 JDK 7 Other
6u25Fixed 7Fixed hs20Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Description
When we cannot do a GC because is GC locker is active, the general approach is to do allocations in the old generation (via the slow allocation path) until all the threads drain from the GC locker and a GC locker-induced GC is scheduled.

In G1, the GC locker is supposed to be the only cause of direct allocations into the old generation (there are currently some bugs that can invalidate this assumption; the fix for 6974966 will eliminate those cases). If we avoid doing direct-to-old allocations alltogether would simplify the code quite a lot. So, instead of direct-to-old allocations we are going to do something different. When the eden is ful, but a GC attempt fails due to the GC locker being active, what we'll do is we'll extend the eden further while we are waiting for the threads in the critical section to drain out of the GC locker and the GC locker to schedule a GC.

There will be a (user-settable) upper bound on how much the eden can grow over its intended size (so that it does not grow out of control). If we reach that, threads that want to allocate will stall until the GC locker-induced GC completes. Hopefully, this will be very rare. Most of the time, we'll only need to extend the eden by a region or two as the GC locker critical sections tend to be reasonable short.

Notice that this should be an improvement on what other GCs do today, which is to take the slow allocation path to allocate every object into the old generation. By extending the eden G1 will be able to support TLAB allocations while the GC locker is active which should have no overhead on the application threads.

Comments
EVALUATION http://hg.openjdk.java.net/jdk7/build/hotspot/rev/016a3628c885
25-12-2010

EVALUATION http://hg.openjdk.java.net/jdk7/hotspot/hotspot/rev/016a3628c885
10-12-2010

EVALUATION http://hg.openjdk.java.net/jdk7/hotspot-gc/hotspot/rev/016a3628c885
08-12-2010

PUBLIC COMMENTS Good point from an e-mail from Jon Masamitsu: Let's say we think 1ms is a non-trivial amount of time. We have the allocation rate of the applications so can we calculate the additional eden space needed? The 1ms is the upper bound on the extra time we're willing to give an application.
22-10-2010

PUBLIC COMMENTS We are leaning towards expressing the "upper bound on how much to extend the eden by" parameter as a percentage of the eden size. Other possibilities include "number of regions" and "explicit size, in ks, mbs, etc.". A possible name could be -XX:MaxHeapExtensionPercent=...
22-10-2010

EVALUATION See Description.
22-10-2010