7196103: NPG: Unable to allocate bit map for parallel garbage collection for the requested heap size

Fri, 07 Sep 2012 16:42:25 -0400

author
coleenp
date
Fri, 07 Sep 2012 16:42:25 -0400
changeset 4048
11fb740ce98f
parent 4047
aed758eda82a
child 4049
4bfe8b33cf66

7196103: NPG: Unable to allocate bit map for parallel garbage collection for the requested heap size
Summary: Don't allocate huge class metaspace size by default on x64
Reviewed-by: stefank, jmasa, kvn

src/share/vm/memory/metaspace.cpp file | annotate | diff | comparison | revisions
src/share/vm/memory/universe.cpp file | annotate | diff | comparison | revisions
src/share/vm/runtime/arguments.cpp file | annotate | diff | comparison | revisions
src/share/vm/runtime/globals.hpp file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/vm/memory/metaspace.cpp	Fri Sep 07 12:04:16 2012 -0400
     1.2 +++ b/src/share/vm/memory/metaspace.cpp	Fri Sep 07 16:42:25 2012 -0400
     1.3 @@ -2779,19 +2779,22 @@
     1.4    _class_space_list = new VirtualSpaceList(rs);
     1.5  }
     1.6  
     1.7 -// Class space probably needs a lot less than data space
     1.8 -const int class_space_divisor = 4;
     1.9  
    1.10  void Metaspace::initialize(Mutex* lock, size_t initial_size) {
    1.11 -  // Use SmallChunk size if not specified, adjust class to smaller size if so.
    1.12 +  // Use SmallChunk size if not specified.   If specified, use this size for
    1.13 +  // the data metaspace.
    1.14    size_t word_size;
    1.15    size_t class_word_size;
    1.16    if (initial_size == 0) {
    1.17      word_size = (size_t) SpaceManager::SmallChunk;
    1.18 -    class_word_size = word_size;
    1.19 +    class_word_size = (size_t) SpaceManager::SmallChunk;
    1.20    } else {
    1.21      word_size = initial_size;
    1.22 -    class_word_size = initial_size/class_space_divisor;
    1.23 +    // Make the first class chunk bigger than a medium chunk so it's not put
    1.24 +    // on the medium chunk list.   The next chunk will be small and progress
    1.25 +    // from there.  This size calculated by -version.
    1.26 +    class_word_size = MIN2((size_t)SpaceManager::MediumChunk*5,
    1.27 +                           (ClassMetaspaceSize/BytesPerWord)*2);
    1.28    }
    1.29  
    1.30    assert(space_list() != NULL,
     2.1 --- a/src/share/vm/memory/universe.cpp	Fri Sep 07 12:04:16 2012 -0400
     2.2 +++ b/src/share/vm/memory/universe.cpp	Fri Sep 07 16:42:25 2012 -0400
     2.3 @@ -858,7 +858,7 @@
     2.4  ReservedSpace Universe::reserve_heap(size_t heap_size, size_t alignment) {
     2.5    // Add in the class metaspace area so the classes in the headers can
     2.6    // be compressed the same as instances.
     2.7 -  size_t total_reserved = heap_size + ClassMetaspaceSize;
     2.8 +  size_t total_reserved = align_size_up(heap_size + ClassMetaspaceSize, alignment);
     2.9    char* addr = Universe::preferred_heap_base(total_reserved, Universe::UnscaledNarrowOop);
    2.10  
    2.11    ReservedHeapSpace total_rs(total_reserved, alignment, UseLargePages, addr);
     3.1 --- a/src/share/vm/runtime/arguments.cpp	Fri Sep 07 12:04:16 2012 -0400
     3.2 +++ b/src/share/vm/runtime/arguments.cpp	Fri Sep 07 16:42:25 2012 -0400
     3.3 @@ -1427,6 +1427,16 @@
     3.4      // if (FLAG_IS_DEFAULT(UseCompressedKlassPointers)) {
     3.5      //   FLAG_SET_ERGO(bool, UseCompressedKlassPointers, true);
     3.6      // }
     3.7 +    // Set the ClassMetaspaceSize to something that will not need to be
     3.8 +    // expanded, since it cannot be expanded.
     3.9 +    if (UseCompressedKlassPointers && FLAG_IS_DEFAULT(ClassMetaspaceSize)) {
    3.10 +      // 100,000 classes seems like a good size, so 100M assumes around 1K
    3.11 +      // per klass.   The vtable and oopMap is embedded so we don't have a fixed
    3.12 +      // size per klass.   Eventually, this will be parameterized because it
    3.13 +      // would also be useful to determine the optimal size of the
    3.14 +      // systemDictionary.
    3.15 +      FLAG_SET_ERGO(uintx, ClassMetaspaceSize, 100*M);
    3.16 +    }
    3.17    }
    3.18    // Also checks that certain machines are slower with compressed oops
    3.19    // in vm_version initialization code.
    3.20 @@ -1965,6 +1975,9 @@
    3.21  
    3.22    status = status && verify_object_alignment();
    3.23  
    3.24 +  status = status && verify_min_value(ClassMetaspaceSize, 1*M,
    3.25 +                                      "ClassMetaspaceSize");
    3.26 +
    3.27    return status;
    3.28  }
    3.29  
    3.30 @@ -2916,7 +2929,7 @@
    3.31                              (UseLargePages && FLAG_IS_CMDLINE(UseLargePages));
    3.32    if (cannot_share) {
    3.33      if (must_share) {
    3.34 -        warning("disabling large pages%s"
    3.35 +        warning("disabling large pages %s"
    3.36                  "because of %s", "" LP64_ONLY("and compressed oops "),
    3.37                  DumpSharedSpaces ? "-Xshare:dump" : "-Xshare:on");
    3.38          FLAG_SET_CMDLINE(bool, UseLargePages, false);
     4.1 --- a/src/share/vm/runtime/globals.hpp	Fri Sep 07 12:04:16 2012 -0400
     4.2 +++ b/src/share/vm/runtime/globals.hpp	Fri Sep 07 16:42:25 2012 -0400
     4.3 @@ -2993,7 +2993,7 @@
     4.4    product(uintx, MaxMetaspaceSize, max_uintx,                               \
     4.5            "Maximum size of Metaspaces (in bytes)")                          \
     4.6                                                                              \
     4.7 -  product(uintx, ClassMetaspaceSize, NOT_LP64(1*M) LP64_ONLY(512*M),        \
     4.8 +  product(uintx, ClassMetaspaceSize, 2*M,                                   \
     4.9            "Maximum size of InstanceKlass area in Metaspace used for "       \
    4.10            "UseCompressedKlassPointers")                                     \
    4.11                                                                              \

mercurial