United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6819077 G1: first GC thread coming late into the GC
JDK-6819077 : G1: first GC thread coming late into the GC

Details
Type:
Enhancement
Submit Date:
2009-03-18
Status:
Closed
Updated Date:
2010-04-06
Project Name:
JDK
Resolved Date:
2010-01-15
Component:
hotspot
OS:
generic
Sub-Component:
gc
CPU:
generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
hs15
Fixed Versions:
hs16 (b08)

Related Reports
Backport:
Backport:
Duplicate:
Relates:

Sub Tasks

Description
We recently tried G1 on a 32GB heap, with a 4GB / 8GB young gen. We noticed that termination times are relatively long (around 30-40ms). The reason for this is that GC worker with id 0 (it's always GC worker with id 0) is late coming into the GC code which results in all the other threads waiting for it during termination. This is clearly a performance bottleneck. We should resolve this.

                                    

Comments
EVALUATION

Ramki pointed out that it's not necessarily the same OS thread that gets id 0. And given that it's always thread 0 that has the issue we suspect some pathology in the G1 code.
                                     
2009-03-18
EVALUATION

Well, with a quick glance at the code I think I've found the culprit.

void
HRInto_G1RemSet::oops_into_collection_set_do(OopsInHeapRegionClosure* oc,
                                             int worker_i) {
  ...
  if (worker_i == 0) {
    _cg1r->clear_and_record_card_counts();
  }
  ...
                                     
2009-03-18
EVALUATION

Adding an extra timer to the code and running the 32GB heap application confirmed that the culprit is indeed the one mentioned in the previous Evaluation note. clear_and_record_card_counts() would take more than 60ms on relatively state-of-the-art hardware.
                                     
2009-03-25
EVALUATION

http://hg.openjdk.java.net/jdk7/hotspot-gc/hotspot/rev/6cb8e9df7174
                                     
2009-08-05
EVALUATION

http://hg.openjdk.java.net/jdk7/hotspot/hotspot/rev/6cb8e9df7174
                                     
2009-08-06



Hardware and Software, Engineered to Work Together