RFR: JDK-8267348: Rewrite gc/epsilon/TestClasses.java to use Metaspace with less classes

Aleksey Shipilev shade at openjdk.java.net
Wed May 19 21:27:26 UTC 2021


On Wed, 19 May 2021 18:26:56 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

>> See the bug report for discussion. The test verifies that Epsilon reacts on Metaspace resizes properly. It started to timeout since Vtable-based CHA implementation landed. The dependency checking walks a lot of classes looking at their oops, and this gets very slow with `+CheckUnhandledOops`. There are measures to improve `CheckUnhandledOops`, but we can also rewrite the test to puff up the same amount of Metaspace with less classes.
>> 
>> I have selected the new constants to match the same Metaspace occupancy like the original test (~25M). New code requires absorbing a few more allocations, so heap size is bumped to 1G, which is similar to other Epsilon tests.
>> 
>> Running with default options before:
>> 
>> 
>> [26.945s][info   ][gc          ] Heap: 128M reserved, 128M (100.00%) committed, 66524K (50.75%) used
>> [26.945s][info   ][gc,metaspace] Metaspace: 69632K reserved, 24896K (35.75%) committed, 24703K (35.48%) used
>> 
>> real	0m47.997s
>> user	1m18.188s
>> sys	0m4.365s
>> 
>> 
>> ...and after:
>> 
>> 
>> [0.818s][info   ][gc          ] Heap: 1024M reserved, 1024M (100.00%) committed, 181M (17.68%) used
>> [0.818s][info   ][gc,metaspace] Metaspace: 86016K reserved, 25856K (30.06%) committed, 25732K (29.92%) used
>> 
>> real	0m19.919s
>> user	0m50.806s
>> sys	0m4.356s
>> 
>> 
>> Running with `-XX:+CheckUnhandledOops` before:
>> 
>> 
>> [394.089s][info   ][gc          ] Heap: 128M reserved, 128M (100.00%) committed, 52731K (40.23%) used
>> [394.089s][info   ][gc,metaspace] Metaspace: 69632K reserved, 19456K (27.94%) committed, 19267K (27.67%) used
>> ...
>> <timeout>
>> 
>> 
>> ...and after:
>> 
>> 
>> [1.952s][info   ][gc          ] Heap: 1024M reserved, 1024M (100.00%) committed, 180M (17.66%) used
>> [1.952s][info   ][gc,metaspace] Metaspace: 86016K reserved, 25856K (30.06%) committed, 25732K (29.92%) used
>> 
>> real	0m27.555s
>> user	0m57.851s
>> sys	0m4.645s
>> 
>> 
>> Additional testing:
>>  - [x] Affected test with `-XX:+CheckUnhandledOops`
>
> test/hotspot/jtreg/gc/epsilon/TestClasses.java line 34:
> 
>> 32:  *          java.base/jdk.internal.misc
>> 33:  *
>> 34:  * @run main/othervm -Xmx1g -XX:MetaspaceSize=1m -XX:MaxMetaspaceSize=64m -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC -Xlog:gc -Xlog:gc+metaspace gc.epsilon.TestClasses
> 
> Why is the heap size increase necessary?

Because this is Epsilon: the new allocations we in field blocks will never be collected. (This is also why the test precomputes the field names, trying not to do that for every class). Look at final "Heap:" messages before/after. Wanted to be on a safe side, so increased it above the 256m it seems to need on my machine. Most other Epsilon tests use `-Xmx1g` anyway.

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

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



More information about the hotspot-gc-dev mailing list