RFR: 8210857: Allow retiring TLABs and collecting statistics in parallel

Per Liden per.liden at oracle.com
Thu Sep 20 10:04:27 UTC 2018

On 09/18/2018 10:16 PM, Per Liden wrote:
> On 09/18/2018 10:13 PM, Per Liden wrote:
>> There is currently no good way of retiring TLABs and collecting their 
>> statistics in parallel. The current code for doing this also traverses 
>> the thread list twice, which is unnecessary. I propose that we adjust 
>> the TLAB API to allow this to be done in parallel, in a single pass.
>> A few notes on this patch:
>> * The GlobalTLABStats class is restructured into the 
>> ThreadLocalAllocStats class to allow for a more flexible way of 
>> collected statistics when retiring TLABs (flexible in the sense that 
>> it allows for parallel operations).
>> * The TLAB API is slightly adjusted. The "make_parsable(bool 
>> retire_tlab)" is broken into two functions, "make_parsable()" to just 
>> make a TLAB parsable, and "retire(ThreadLocalAllocStats* stats)" to 
>> retire and optionally collects statistics.
>> * GCs are unaffected by this change, in the sense that they continue 
>> to call CollectedHeap::ensure_parsability(). However, all GCs will 
>> benefit from now doing a single pass over the thread list instead of 
>> two to retire and collect stats.
>> * This is the last patch in my series of TLAB related patches. The 
>> remaining patches only touch ZGC to actually retire/resize/remap TLABs 
>> in parallel.
>> Bug: https://bugs.openjdk.java.net/browse/JDK-8210857
>> Webrev: http://cr.openjdk.java.net/~pliden/8210857/webrev.0
> Testing: Passed tier{1,2,3,4,5,6} on linux-x86_64 (product and debug)

Discussed with Erik and Stefan off-line, which resulted in the following 
adjustment. This adjustment actually fixes a long standing bug we've 
had, when make_parsable(false) is called and ZeroTLAB is true, in which 
case we actually retire the TLAB but failed to call 
Thread::incr_allocated_bytes() to update the number of allocated bytes.

Diff: http://cr.openjdk.java.net/~pliden/8210857/webrev.0vs1
Full: http://cr.openjdk.java.net/~pliden/8210857/webrev.1


More information about the hotspot-gc-dev mailing list