RFR: 8169931: 8k class metaspace chunks misallocated from 4k chunk freelist

Stefan Karlsson stefan.karlsson at oracle.com
Tue Nov 22 14:54:55 UTC 2016

Hi all,

Please, review this patch to fix a bug in ChunkManager::list_index():

There's a great description of the bug in the bug report:

There are two conceptual parts of the metaspace. The _class_ metaspace, 
and the _non-class_ metaspace. They have different chunk sizes, and 
while querying for the list index of a humongous chunk in the class 
metaspace, the code accidentally matched the size against the 
MediumChunk size of the non-class metaspace.

I've changed the code to not query against the global ChunkSizes enum, 
but rather the values stored inside the ChunkManager instances. 
Therefore, the list_index() function was changed into an instance method.

I've written a unit test that provoked the bug. It's a simplified test 
with vm asserts instead of gtest asserts. The reason is that the 
ChunkManager class is currently located in metaspace.cpp, and is not 
accessible from the gtest unit tests.

Testing: jprt, Kitchensink, parallel class loading tests


More information about the hotspot-dev mailing list