RFR: 8264008: Incorrect metaspace statistics after JEP 387 when UseCompressedClassPointers is off [v2]
Jie Fu
jiefu at openjdk.java.net
Tue Mar 23 07:43:58 UTC 2021
> 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:
Add a test run to reproduce the bug
-------------
Changes:
- all: https://git.openjdk.java.net/jdk/pull/3142/files
- new: https://git.openjdk.java.net/jdk/pull/3142/files/137b9267..c72e91ec
Webrevs:
- full: https://webrevs.openjdk.java.net/?repo=jdk&pr=3142&range=01
- incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=3142&range=00-01
Stats: 12 lines in 1 file changed: 11 ins; 0 del; 1 mod
Patch: https://git.openjdk.java.net/jdk/pull/3142.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/3142/head:pull/3142
PR: https://git.openjdk.java.net/jdk/pull/3142
More information about the hotspot-runtime-dev
mailing list