RFR: 8264008: Incorrect metaspace statistics after JEP 387 when UseCompressedClassPointers is off [v3]
Thomas Stuefe
stuefe at openjdk.java.net
Wed Mar 24 05:20:39 UTC 2021
On Tue, 23 Mar 2021 23:22:52 GMT, Jie Fu <jiefu at openjdk.org> wrote:
>> Hi all,
>>
>> Metaspace statistics is incorrect after JEP 387 when UseCompressedClassPointers is off.
>>
>> For example, here is the incorrect metaspace statistics before the fix:
>> Event:jdk.MetaspaceSummary {
>> startTime = 10:35:24.762
>> gcId = 3
>> when = "Before GC"
>> gcThreshold = 21.0 MB
>> metaspace = {
>> committed = 10.3 MB
>> used = 10.2 MB
>> reserved = 16.0 MB
>> }
>> dataSpace = {
>> committed = 10.3 MB
>> used = 10.2 MB
>> reserved = 16.0 MB
>> }
>> classSpace = {
>> committed = 10.3 MB
>> used = 10.2 MB
>> reserved = 16.0 MB
>> }
>> }
>>
>> This bug can be reproduced by running the following tests with `-XX:-UseCompressedClassPointers`, which would pass before JEP 387.
>> jdk/jfr/event/gc/heapsummary/TestHeapSummaryEventDefNewSerial.java
>> jdk/jfr/event/gc/heapsummary/TestHeapSummaryEventG1.java
>> jdk/jfr/event/gc/heapsummary/TestHeapSummaryEventPSParOld.java
>>
>> The failing reason is that `Metaspace::is_class_space_allocation(mdtype)` [1] will always return false when `UseCompressedClassPointers` is off.
>> So `RunningCounters::committed_words_nonclass()` will be returned even called with `Metaspace::is_class_space_allocation(Metaspace::ClassType)`, which is unreasonable.
>> And `MetaspaceUtils::reserved_words(Metaspace::MetadataType mdtype)`/`MetaspaceUtils::used_words(Metaspace::MetadataType mdtype)` also suffer from the same bug.
>>
>> Thanks.
>> Best regards,
>> Jie
>>
>> [1] https://github.com/openjdk/jdk/blob/master/src/hotspot/share/memory/metaspace.cpp#L90
>>
>>
>> Metaspace statistics after the fix:
>> Event:jdk.MetaspaceSummary {
>> startTime = 10:44:38.230
>> gcId = 1
>> when = "After GC"
>> gcThreshold = 21.0 MB
>> metaspace = {
>> committed = 10.3 MB
>> used = 10.2 MB
>> reserved = 16.0 MB
>> }
>> dataSpace = {
>> committed = 10.3 MB
>> used = 10.2 MB
>> reserved = 16.0 MB
>> }
>> classSpace = {
>> committed = 0 bytes
>> used = 0 bytes
>> reserved = 0 bytes
>> }
>> }
>
> Jie Fu has updated the pull request incrementally with one additional commit since the last revision:
>
> Exclude 32-bit vm
Looks good!
-------------
Marked as reviewed by stuefe (Reviewer).
PR: https://git.openjdk.java.net/jdk/pull/3142
More information about the hotspot-runtime-dev
mailing list