RFR: 8264411: serviceability/jvmti/HeapMonitor tests intermittently fail due to large TLAB size [v2]

Hui Shi hshi at openjdk.java.net
Sat Apr 3 04:27:38 UTC 2021


On Fri, 2 Apr 2021 20:08:50 GMT, Chris Plummer <cjplummer at openjdk.org> wrote:

>> Hui Shi has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   update copyright year
>
> test/hotspot/jtreg/serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitor.java line 176:
> 
>> 174:     //    and set _bytes_until_sample to 0.
>> 175:     //    initial _bytes_until_sample is geometric variable with the specified mean
>> 176:     //    (512K by default), check ThreadHeapSampler::pick_next_geometric_sample()
> 
> I think there is too much detail about the hotspot implementation in these comments. I think for (1) it is enough to say that the current TLAB needs to be consumed, and that this can be accomplished with a System.gc(). For (2) I don't really understand what you are saying. If you can explaining without referring to specific fields in hotspot, that would be better. I also don't understand how you are making sure that (2) is triggered. Does that happen during the allocation loop?

Thanks for your patient review!New comment is simplified.

Step1 is retiring current TLAB. 

When allocating new TLAB, runtime checks if JVMTI object sample is enabled and report event.  After report runtime also calculates how many bytes to skip before perform next object sample, which is stored in ThreadHeapSampler's field _bytes_until_sample. Also need consume these bytes before runtime picks up user specified object sample interval bytes (0 in this case).
 
Step2 is an allocation loop consumes current ThreadHeapSampler's _bytes_until_sample bytes (initial value is randome size about 512K).

> test/hotspot/jtreg/serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitor.java line 180:
> 
>> 178:     // trigger GC to consume current TLAB in step1
>> 179:     // consume initial _bytes_until_sample in following loops, each iteration consume
>> 180:     // about 1600KB, 10 iterations can definitly consume intitial _bytes_until_sample
> 
> I think this comment should be after the System.gc() call.

Thanks and accepted.

-------------

PR: https://git.openjdk.java.net/jdk/pull/3265


More information about the serviceability-dev mailing list