Review request: 8026391: The Metachunk header wastes memory - 8026392: Metachunks and Metablocks are using a too large alignment
stefan.karlsson at oracle.com
Tue Oct 15 13:26:32 PDT 2013
On 10/15/13 10:01 PM, Coleen Phillimore wrote:
> This is good, so we align metachunks to 8 byte alignment rather than
> 16 in 64 bit?
> #define ARENA_AMALLOC_ALIGNMENT (2*BytesPerWord)
Yes. Just like we did with the PermGen.
> On 10/15/2013 02:11 PM, Stefan Karlsson wrote:
>> From an offline discussion with Jon, I decided to change the following:
>> $ hg diff
>> diff -r 8e2b57a0132c src/share/vm/memory/metachunk.cpp
>> --- a/src/share/vm/memory/metachunk.cpp Tue Oct 15 14:32:20 2013
>> +++ b/src/share/vm/memory/metachunk.cpp Tue Oct 15 20:07:51 2013
>> @@ -37,8 +37,8 @@
>> // so that 64 bit types get correctly aligned.
>> const size_t alignment = 8;
>> + // Make sure that the Klass alignment also agree.
>> STATIC_ASSERT(alignment == (size_t)KlassAlignmentInBytes);
>> - STATIC_ASSERT(alignment == (size_t)BytesPerLong);
>> return alignment;
>> On 10/14/13 1:58 PM, Stefan Karlsson wrote:
>>> Please, review these two patches to remove some of the wastages
>>> introduced in the metaspace.
>>> 8026391: The Metachunk header wastes memory
>>> There are a couple of fields in Metachunk that store already known
>>> information, like the beginning and the end of the Metachunk. I
>>> replaced those fields with code instead.
>>> To make this easier, I extracted some duplicated code in Metablock
>>> and Metachunk into a super class named Metamem. The extracted code
>>> is purely needed to allow these objects to be placed on the FreeList
>>> and in the BinaryTreeDictionary.
>>> 8026392: Metachunks and Metablocks are using a too large alignment
>>> The metaspace code was using ARENA_ALIGN to align the Metablocks and
>>> Metachunk header. This forced all allocations of metadata to be 16
>>> bytes aligned. This patch patch changes the restriction to be 8
>>> bytes instead, since that's the restriction needed for 64 bit types
>>> like long, double, pointers and klass pointers,
>>> Testing: Added unit test for Metachunk. JPRT (before splitting of
>>> the patches)
More information about the hotspot-dev