JDK-7187490 : G1: Limit the amount of remembered set scrubbing
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 7u6
  • Priority: P4
  • Status: Closed
  • Resolution: Won't Fix
  • OS: generic
  • CPU: generic
  • Submitted: 2012-07-27
  • Updated: 2017-05-16
  • Resolved: 2017-05-16
Related Reports
Duplicate :  
Relates :  
Relates :  
Description
During the cleanup operation, that is part of G1's concurrent marking algorithm, the RSets of all the regions in the heap are scrubbed. Basically entries coming from dead regions and dead objects are removed.

This has a positive effect on RSet scanning times during the following maixed GCs (since there are little or no extraneous entries an a regions RSet). The negative of this operation is that it can be very expensive (depending upon # of regions and the region size). For regions which are mostly full we incur the penalty of scrubbing the RSet without really reducing the number of entries by much.

This behavior was seen with a customer application:

2012-06-13T10:32:49.662-0700: 72269.812: [GC remark 72269.825: [GC ref-proc, 0.0008720 secs], 0.0980720 secs]
 [Times: user=0.37 sys=0.00, real=0.10 secs] 
2012-06-13T10:32:49.779-0700: 72269.929: [GC cleanup 37679M->37655M(55296M), 1.0483700 secs]
 [Times: user=4.17 sys=0.01, real=1.05 secs] 
2012-06-13T10:32:50.829-0700: 72270.978: [GC concurrent-cleanup-start]
2012-06-13T10:32:50.829-0700: 72270.978: [GC concurrent-cleanup-end, 0.0000620]

At the end of the cleanup pause few (if any) regions were being freed and the pause was taking a huge amount of time.

Instrumentation indicated that the almost all of the time of the cleanup pause was being taken up by RSet scrubbing.

It might be to reduce the amount of RSet scrubbing by not scrubbing (or at least reducing the amount) the RSets of regions that we are not going to collect during the next mixed GC phase. We would let the RSets of these regions grow until they will be collected during a mixed GC phase and then we will fully scrub their RSets.

Comments
Closing this as WNF for now as JDK-8180415 seems to be the far superior option as it completely removes the need for scrubbing.
16-05-2017

Rebuilding the remembered sets during marking (JDK-8180415) would obviate the need for remembered set scrubbing completely.
16-05-2017

(From JDK-8043574) Conceptually it is not necessary to do this RSet scrubbing in the GC cleanup pause - presumably it is currently done there because after marking completed, you get the most gain out of this. It could be done concurrently to the mutator or incrementally in other pauses. Think of ways to distribute this work across mutator or gc time. Concurrent scrubbing could be done by: 1) during gc pause, disconnect the remembered set of the target region(s) from these regions, and empty it 2) a concurrent thread iterate over the cards of the remembered sets one by one and if a cross-region reference is found, add an entry to the corresponding remembered set.
03-11-2014