src/hotspot/share/memory/metaspace/settings.hpp
author stuefe
Wed, 16 Oct 2019 16:10:24 +0200
branchstuefe-new-metaspace-branch
changeset 58646 bcdba1c9f1fe
parent 58333 78b2e8f46dd4
child 58840 7678903a348f
permissions -rw-r--r--
Remove experimental MetaspaceSeparateMicroCLDs feature, since its effect was underwhelming
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
58063
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
     1
/*
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
     2
 * Copyright (c) 2019 SAP SE. All rights reserved.
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
     3
 * Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved.
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
     4
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
     5
 *
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
     6
 * This code is free software; you can redistribute it and/or modify it
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
     7
 * under the terms of the GNU General Public License version 2 only, as
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
     8
 * published by the Free Software Foundation.
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
     9
 *
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    10
 * This code is distributed in the hope that it will be useful, but WITHOUT
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    11
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    12
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    13
 * version 2 for more details (a copy is included in the LICENSE file that
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    14
 * accompanied this code).
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    15
 *
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    16
 * You should have received a copy of the GNU General Public License version
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    17
 * 2 along with this work; if not, write to the Free Software Foundation,
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    18
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    19
 *
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    20
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    21
 * or visit www.oracle.com if you need additional information or have any
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    22
 * questions.
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    23
 *
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    24
 */
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    25
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    26
#ifndef SHARE_MEMORY_METASPACE_CONSTANTS_HPP
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    27
#define SHARE_MEMORY_METASPACE_CONSTANTS_HPP
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    28
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    29
#include "memory/allocation.hpp"
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    30
#include "memory/metaspace/chunkLevel.hpp"
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    31
#include "utilities/globalDefinitions.hpp"
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    32
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    33
namespace metaspace {
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    34
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    35
class Settings : public AllStatic {
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    36
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    37
  // Granularity, in bytes, metaspace is committed with.
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    38
  static size_t _commit_granule_bytes;
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    39
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    40
  // Granularity, in words, metaspace is committed with.
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    41
  static size_t _commit_granule_words;
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    42
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    43
  // Whether or not commit new-born root chunks thru after creation.
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    44
  static bool _newborn_root_chunks_are_fully_committed;
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    45
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    46
  // When a chunk is handed out by the ChunkManager to a class loader, how much
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    47
  // of a chunk should be committed up-front?
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    48
  // Size in words. Will be rounded up to the nearest multiple of commit_granule_words.
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    49
  // (Note: 0 is possible but inefficient, since it will cause the ClassLoaderMetaspace
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    50
  //        to commit the first granule right away anyway, so nothing is saved.
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    51
  //        chklvl::MAX_CHUNK_WORD_SIZE pretty much means every chunk is committed thru
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    52
  //        from the start.
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    53
  static size_t _committed_words_on_fresh_chunks;
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    54
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    55
  // The default size of a non-class VirtualSpaceNode (unless created differently).
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    56
  // Must be a multiple of the root chunk size.
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    57
  static const size_t _virtual_space_node_default_word_size = chklvl::MAX_CHUNK_WORD_SIZE * 2; // lets go with 8mb virt size. Seems a good compromise betw. virt and mapping fragmentation.
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    58
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    59
  static const size_t _allocation_from_dictionary_limit = 4 * K;
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    60
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    61
  // When allocating from a chunk, if the remaining area in the chunk is too small to hold
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    62
  // the requested size, we attempt to double the chunk size in place...
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    63
  static bool   _enlarge_chunks_in_place;
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    64
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    65
  // .. but we do only do this for chunks below a given size to prevent unnecessary memory blowup.
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    66
  static size_t _enlarge_chunks_in_place_max_word_size;
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    67
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    68
  // If true, chunks are uncommitted after gc (when metaspace is purged).
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    69
  static bool _uncommit_on_return;
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    70
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    71
  // If true, vsnodes which only contain free chunks will be deleted (purged) as part of a gc.
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    72
  static bool _delete_nodes_on_purge;
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    73
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    74
  // If _uncommit_on_return is true:
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    75
  // Minimum word size a chunk has to have after returning and merging with neighboring free chunks
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    76
  // to be candidate for uncommitting. Must be a multiple of and not smaller than commit granularity.
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    77
  static size_t _uncommit_on_return_min_word_size;
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    78
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    79
  // If true, chunks are uncommitted after gc (when metaspace is purged).
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    80
  static bool _uncommit_on_purge;
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    81
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    82
  // If _uncommit_on_purge is true:
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    83
  // Minimum word size of an area to be candidate for uncommitting.
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    84
  // Must be a multiple of and not smaller than commit granularity.
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    85
  static size_t _uncommit_on_purge_min_word_size;
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    86
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    87
public:
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    88
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    89
  static size_t commit_granule_bytes()                        { return _commit_granule_bytes; }
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    90
  static size_t commit_granule_words()                        { return _commit_granule_words; }
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    91
  static bool newborn_root_chunks_are_fully_committed()       { return _newborn_root_chunks_are_fully_committed; }
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    92
  static size_t committed_words_on_fresh_chunks()             { return _committed_words_on_fresh_chunks; }
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    93
  static size_t virtual_space_node_default_word_size()        { return _virtual_space_node_default_word_size; }
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    94
  static size_t allocation_from_dictionary_limit()            { return _allocation_from_dictionary_limit; }
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    95
  static bool enlarge_chunks_in_place()                       { return _enlarge_chunks_in_place; }
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    96
  static size_t enlarge_chunks_in_place_max_word_size()       { return _enlarge_chunks_in_place_max_word_size; }
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    97
  static bool uncommit_on_return()                            { return _uncommit_on_return; }
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    98
  static size_t uncommit_on_return_min_word_size()            { return _uncommit_on_return_min_word_size; }
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    99
  static bool delete_nodes_on_purge()                         { return _delete_nodes_on_purge; }
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   100
  static bool uncommit_on_purge()                             { return _uncommit_on_purge; }
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   101
  static size_t uncommit_on_purge_min_word_size()             { return _uncommit_on_purge_min_word_size; }
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   102
58333
78b2e8f46dd4 add experimental option to cluster micro clds.
stuefe
parents: 58069
diff changeset
   103
  static void ergo_initialize();
58063
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   104
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   105
  static void print_on(outputStream* st);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   106
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   107
};
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   108
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   109
} // namespace metaspace
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   110
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
   111
#endif // SHARE_MEMORY_METASPACE_BLOCKFREELIST_HPP