United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: 6994056 G1: when GC locker is active, extend the Eden instead of allocating into the old gen
6994056 : G1: when GC locker is active, extend the Eden instead of allocating into the old gen

Details
Type:
Enhancement
Submit Date:
2010-10-22
Status:
Closed
Updated Date:
2011-04-23
Project Name:
JDK
Resolved Date:
2011-04-23
Component:
hotspot
OS:
generic
Sub-Component:
gc
CPU:
generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
hs20
Fixed Versions:
hs20

Related Reports
Backport:
Backport:
Relates:
Relates:
Relates:
Relates:

Sub Tasks

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
                                     
2010-12-25
EVALUATION

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

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

See Description.
                                     
2010-10-22
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=...
                                     
2010-10-22
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.
                                     
2010-10-22



Hardware and Software, Engineered to Work Together