Tune chunk sizes to reduce waste sections stuefe-new-metaspace-branch
authorstuefe
Sun, 27 Oct 2019 10:14:40 +0100
branchstuefe-new-metaspace-branch
changeset 58807 3863dfd99d8e
parent 58717 5e9e519e5dc9
child 58838 55ce65813b62
Tune chunk sizes to reduce waste sections
src/hotspot/share/memory/metaspace/chunkAllocSequence.cpp
--- a/src/hotspot/share/memory/metaspace/chunkAllocSequence.cpp	Mon Oct 21 18:15:53 2019 +0200
+++ b/src/hotspot/share/memory/metaspace/chunkAllocSequence.cpp	Sun Oct 27 10:14:40 2019 +0100
@@ -59,14 +59,12 @@
 
 // hard-coded chunk allocation sequences for various space types
 
-///////////////////////////
-// chunk allocation sequences for normal loaders:
 static const chklvl_t g_sequ_standard_non_class[] = {
     chklvl::CHUNK_LEVEL_4K,
     chklvl::CHUNK_LEVEL_4K,
     chklvl::CHUNK_LEVEL_4K,
     chklvl::CHUNK_LEVEL_4K,
-    chklvl::CHUNK_LEVEL_64K
+    chklvl::CHUNK_LEVEL_16K
     // .. repeat last
 };
 
@@ -75,28 +73,28 @@
     chklvl::CHUNK_LEVEL_2K,
     chklvl::CHUNK_LEVEL_2K,
     chklvl::CHUNK_LEVEL_2K,
-    chklvl::CHUNK_LEVEL_32K
+    chklvl::CHUNK_LEVEL_16K
     // .. repeat last
 };
 
-///////////////////////////
-// chunk allocation sequences for reflection/anonymous loaders:
-// We allocate four smallish chunks before progressing to bigger chunks.
 static const chklvl_t g_sequ_anon_non_class[] = {
     chklvl::CHUNK_LEVEL_1K,
-    chklvl::CHUNK_LEVEL_1K,
-    chklvl::CHUNK_LEVEL_1K,
-    chklvl::CHUNK_LEVEL_1K,
-    chklvl::CHUNK_LEVEL_2K
     // .. repeat last
 };
 
 static const chklvl_t g_sequ_anon_class[] = {
     chklvl::CHUNK_LEVEL_1K,
-    chklvl::CHUNK_LEVEL_1K,
+    // .. repeat last
+};
+
+static const chklvl_t g_sequ_refl_non_class[] = {
+    chklvl::CHUNK_LEVEL_2K,
+    chklvl::CHUNK_LEVEL_1K
+    // .. repeat last
+};
+
+static const chklvl_t g_sequ_refl_class[] = {
     chklvl::CHUNK_LEVEL_1K,
-    chklvl::CHUNK_LEVEL_1K,
-    chklvl::CHUNK_LEVEL_2K
     // .. repeat last
 };
 
@@ -107,6 +105,8 @@
 DEFINE_CLASS_FOR_ARRAY(standard_class)
 DEFINE_CLASS_FOR_ARRAY(anon_non_class)
 DEFINE_CLASS_FOR_ARRAY(anon_class)
+DEFINE_CLASS_FOR_ARRAY(refl_non_class)
+DEFINE_CLASS_FOR_ARRAY(refl_class)
 
 
 class BootLoaderChunkAllocSequence : public ChunkAllocSequence {
@@ -164,7 +164,7 @@
   if (is_class) {
     switch(space_type) {
     case StandardMetaspaceType:          return &g_chunk_alloc_sequence_standard_class;
-    case ReflectionMetaspaceType:
+    case ReflectionMetaspaceType:        return &g_chunk_alloc_sequence_refl_class;
     case UnsafeAnonymousMetaspaceType:   return &g_chunk_alloc_sequence_anon_class;
     case BootMetaspaceType:              return &g_chunk_alloc_sequence_boot_non_class;
     default: ShouldNotReachHere();
@@ -172,7 +172,7 @@
   } else {
     switch(space_type) {
     case StandardMetaspaceType:          return &g_chunk_alloc_sequence_standard_non_class;
-    case ReflectionMetaspaceType:
+    case ReflectionMetaspaceType:        return &g_chunk_alloc_sequence_refl_non_class;
     case UnsafeAnonymousMetaspaceType:   return &g_chunk_alloc_sequence_anon_non_class;
     case BootMetaspaceType:              return &g_chunk_alloc_sequence_boot_non_class;
     default: ShouldNotReachHere();