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

Coleen Phillimore coleen.phillimore at oracle.com
Tue Nov 22 19:30:24 UTC 2016

Can you put this test at the end of the file with // Unit Tests and an 
explanation why this is here so people don't try to port the whole thing 
to gtest?

I was looking for uses of list_index and found this code, which looks wrong:

   assert((word_size <= chunk->word_size()) ||
          list_index(chunk->word_size() == HumongousIndex),
          "Non-humongous variable sized chunk");

This change looks good though.


On 11/22/16 9:54 AM, Stefan Karlsson wrote:
> Hi all,
> Please, review this patch to fix a bug in ChunkManager::list_index():
>  http://cr.openjdk.java.net/~stefank/8169931/webrev.01
> There's a great description of the bug in the bug report:
>  https://bugs.openjdk.java.net/browse/JDK-8169931
> 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
> Thanks,
> StefanK

More information about the hotspot-dev mailing list