# HG changeset patch # User stuefe # Date 1575048065 -3600 # Fri Nov 29 18:21:05 2019 +0100 # Branch stuefe-new-metaspace-branch # Node ID 718a09a872d0c8f7de3396ed867a602fb2ef5c58 # Parent de02f487a78abc5cd0ffaadf22462834fa1dc203 [mq]: remove-blockfreelist diff -r de02f487a78a -r 718a09a872d0 src/hotspot/share/memory/metaspace/blockFreelist.cpp --- a/src/hotspot/share/memory/metaspace/blockFreelist.cpp Fri Mar 01 13:59:26 2019 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ -#include "precompiled.hpp" - -#include "logging/log.hpp" -#include "memory/binaryTreeDictionary.inline.hpp" -#include "memory/metaspace/blockFreelist.hpp" -#include "utilities/ostream.hpp" -#include "utilities/globalDefinitions.hpp" - - -namespace metaspace { - - -BlockFreelist::BlockFreelist() : _dictionary(new BlockTreeDictionary()), _small_blocks(NULL) {} - -BlockFreelist::~BlockFreelist() { - delete _dictionary; - if (_small_blocks != NULL) { - delete _small_blocks; - } -} - -void BlockFreelist::return_block(MetaWord* p, size_t word_size) { - assert(word_size >= SmallBlocks::small_block_min_word_size(), - "attempting to return dark matter (" SIZE_FORMAT ").", word_size); - - Metablock* free_chunk = ::new (p) Metablock(word_size); - if (word_size < SmallBlocks::small_block_max_word_size()) { - small_blocks()->return_block(free_chunk, word_size); - } else { - dictionary()->return_chunk(free_chunk); -} - log_trace(gc, metaspace, freelist, blocks)("returning block at " INTPTR_FORMAT " size = " - SIZE_FORMAT, p2i(free_chunk), word_size); -} - -MetaWord* BlockFreelist::get_block(size_t word_size) { - assert(word_size >= SmallBlocks::small_block_min_word_size(), "never get dark matter"); - - // Try small_blocks first. - if (word_size < SmallBlocks::small_block_max_word_size()) { - // Don't create small_blocks() until needed. small_blocks() allocates the small block list for - // this space manager. - MetaWord* new_block = (MetaWord*) small_blocks()->get_block(word_size); - if (new_block != NULL) { - log_trace(gc, metaspace, freelist, blocks)("getting block at " INTPTR_FORMAT " size = " SIZE_FORMAT, - p2i(new_block), word_size); - return new_block; - } - } - - if (word_size < BlockFreelist::min_dictionary_size()) { - // If allocation in small blocks fails, this is Dark Matter. Too small for dictionary. - return NULL; - } - - Metablock* free_block = dictionary()->get_chunk(word_size); - if (free_block == NULL) { - return NULL; - } - - const size_t block_size = free_block->size(); - if (block_size > WasteMultiplier * word_size) { - return_block((MetaWord*)free_block, block_size); - return NULL; - } - - MetaWord* new_block = (MetaWord*)free_block; - assert(block_size >= word_size, "Incorrect size of block from freelist"); - const size_t unused = block_size - word_size; - if (unused >= SmallBlocks::small_block_min_word_size()) { - return_block(new_block + word_size, unused); - } - - log_trace(gc, metaspace, freelist, blocks)("getting block at " INTPTR_FORMAT " size = " SIZE_FORMAT, - p2i(new_block), word_size); - return new_block; -} - -void BlockFreelist::print_on(outputStream* st) const { - dictionary()->print_free_lists(st); - if (_small_blocks != NULL) { - _small_blocks->print_on(st); - } -} - -} // namespace metaspace - diff -r de02f487a78a -r 718a09a872d0 src/hotspot/share/memory/metaspace/blockFreelist.hpp --- a/src/hotspot/share/memory/metaspace/blockFreelist.hpp Fri Mar 01 13:59:26 2019 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -#ifndef SHARE_MEMORY_METASPACE_BLOCKFREELIST_HPP -#define SHARE_MEMORY_METASPACE_BLOCKFREELIST_HPP - -#include "memory/allocation.hpp" -#include "memory/binaryTreeDictionary.hpp" -#include "memory/freeList.hpp" -#include "memory/metaspace/smallBlocks.hpp" -#include "memory/metaspace/metablock.hpp" -#include "utilities/globalDefinitions.hpp" - -namespace metaspace { - -typedef BinaryTreeDictionary > BlockTreeDictionary; - -// Used to manage the free list of Metablocks (a block corresponds -// to the allocation of a quantum of metadata). -class BlockFreelist : public CHeapObj { - - BlockTreeDictionary* const _dictionary; - SmallBlocks* _small_blocks; - - // Only allocate and split from freelist if the size of the allocation - // is at least 1/4th the size of the available block. - const static int WasteMultiplier = 4; - - // Accessors - BlockTreeDictionary* dictionary() const { return _dictionary; } - SmallBlocks* small_blocks() { - if (_small_blocks == NULL) { - _small_blocks = new SmallBlocks(); - } - return _small_blocks; - } - - public: - - BlockFreelist(); - ~BlockFreelist(); - - // Get and return a block to the free list - MetaWord* get_block(size_t word_size); - void return_block(MetaWord* p, size_t word_size); - - // Returns the total size, in words, of all blocks kept in this structure. - size_t total_size() const { - size_t result = dictionary()->total_size(); - if (_small_blocks != NULL) { - result = result + _small_blocks->total_size(); - } - return result; - } - - // Returns the number of all blocks kept in this structure. - uintx num_blocks() const { - uintx result = dictionary()->total_free_blocks(); - if (_small_blocks != NULL) { - result = result + _small_blocks->total_num_blocks(); - } - return result; - } - - static size_t min_dictionary_size() { return TreeChunk >::min_size(); } - void print_on(outputStream* st) const; -}; - -} // namespace metaspace - -#endif // SHARE_MEMORY_METASPACE_BLOCKFREELIST_HPP diff -r de02f487a78a -r 718a09a872d0 src/hotspot/share/memory/metaspace/chunkLevel.hpp --- a/src/hotspot/share/memory/metaspace/chunkLevel.hpp Fri Mar 01 13:59:26 2019 +0100 +++ b/src/hotspot/share/memory/metaspace/chunkLevel.hpp Fri Nov 29 18:21:05 2019 +0100 @@ -128,4 +128,4 @@ } // namespace metaspace -#endif // SHARE_MEMORY_METASPACE_BLOCKFREELIST_HPP +#endif // SHARE_MEMORY_METASPACE_CHUNKLEVEL_HPP diff -r de02f487a78a -r 718a09a872d0 src/hotspot/share/memory/metaspace/leftOverBins.hpp --- a/src/hotspot/share/memory/metaspace/leftOverBins.hpp Fri Mar 01 13:59:26 2019 +0100 +++ b/src/hotspot/share/memory/metaspace/leftOverBins.hpp Fri Nov 29 18:21:05 2019 +0100 @@ -73,6 +73,8 @@ public: + // Returns smallest size, in words, a block has to have + // to be managed by the LeftOverManager static size_t minimal_word_size() { return VerySmallBinsType::minimal_word_size(); } diff -r de02f487a78a -r 718a09a872d0 src/hotspot/share/memory/metaspace/settings.cpp --- a/src/hotspot/share/memory/metaspace/settings.cpp Fri Mar 01 13:59:26 2019 +0100 +++ b/src/hotspot/share/memory/metaspace/settings.cpp Fri Nov 29 18:21:05 2019 +0100 @@ -53,7 +53,6 @@ bool Settings::_uncommit_on_purge = false; size_t Settings::_uncommit_on_purge_min_word_size = 0; -bool Settings::_use_lom = false; @@ -132,8 +131,6 @@ _enlarge_chunks_in_place = MetaspaceEnlargeChunksInPlace; _enlarge_chunks_in_place_max_word_size = 256 * K; - _use_lom = MetaspaceUseLOM; - // Sanity checks. guarantee(commit_granule_words() <= chklvl::MAX_CHUNK_WORD_SIZE, "Too large granule size"); guarantee(is_power_of_2(commit_granule_words()), "granule size must be a power of 2"); @@ -165,7 +162,6 @@ st->print_cr(" - uncommit_on_purge: %d.", (int)uncommit_on_purge()); st->print_cr(" - uncommit_on_purge_min_word_size: " SIZE_FORMAT ".", uncommit_on_purge_min_word_size()); - st->print_cr(" - use_lom: %d.", use_lom()); } diff -r de02f487a78a -r 718a09a872d0 src/hotspot/share/memory/metaspace/settings.hpp --- a/src/hotspot/share/memory/metaspace/settings.hpp Fri Mar 01 13:59:26 2019 +0100 +++ b/src/hotspot/share/memory/metaspace/settings.hpp Fri Nov 29 18:21:05 2019 +0100 @@ -88,9 +88,6 @@ // whose lower 32bits are zero. static const bool _do_not_return_32bit_aligned_addresses = true; - // Use Lom - static bool _use_lom; - public: static size_t commit_granule_bytes() { return _commit_granule_bytes; } @@ -108,8 +105,6 @@ static size_t uncommit_on_purge_min_word_size() { return _uncommit_on_purge_min_word_size; } static bool do_not_return_32bit_aligned_addresses() { return _do_not_return_32bit_aligned_addresses; } - static bool use_lom() { return _use_lom; } - static void ergo_initialize(); static void print_on(outputStream* st); diff -r de02f487a78a -r 718a09a872d0 src/hotspot/share/memory/metaspace/smallBlocks.cpp --- a/src/hotspot/share/memory/metaspace/smallBlocks.cpp Fri Mar 01 13:59:26 2019 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ -#include "precompiled.hpp" - -#include "memory/metaspace/smallBlocks.hpp" -#include "utilities/globalDefinitions.hpp" -#include "utilities/ostream.hpp" - -namespace metaspace { - -void SmallBlocks::print_on(outputStream* st) const { - st->print_cr("SmallBlocks:"); - for (uint i = _small_block_min_word_size; i < _small_block_max_word_size; i++) { - uint k = i - _small_block_min_word_size; - st->print_cr("small_lists size " SIZE_FORMAT " count " SIZE_FORMAT, _small_lists[k].size(), _small_lists[k].count()); - } -} - - -// Returns the total size, in words, of all blocks, across all block sizes. -size_t SmallBlocks::total_size() const { - size_t result = 0; - for (uint i = _small_block_min_word_size; i < _small_block_max_word_size; i++) { - uint k = i - _small_block_min_word_size; - result = result + _small_lists[k].count() * _small_lists[k].size(); - } - return result; -} - -// Returns the total number of all blocks across all block sizes. -uintx SmallBlocks::total_num_blocks() const { - uintx result = 0; - for (uint i = _small_block_min_word_size; i < _small_block_max_word_size; i++) { - uint k = i - _small_block_min_word_size; - result = result + _small_lists[k].count(); - } - return result; -} - -} // namespace metaspace - diff -r de02f487a78a -r 718a09a872d0 src/hotspot/share/memory/metaspace/smallBlocks.hpp --- a/src/hotspot/share/memory/metaspace/smallBlocks.hpp Fri Mar 01 13:59:26 2019 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -#ifndef SHARE_MEMORY_METASPACE_SMALLBLOCKS_HPP -#define SHARE_MEMORY_METASPACE_SMALLBLOCKS_HPP - -#include "memory/allocation.hpp" -#include "memory/binaryTreeDictionary.hpp" -#include "memory/metaspace/metablock.hpp" -#include "utilities/debug.hpp" -#include "utilities/globalDefinitions.hpp" - -class outputStream; - -namespace metaspace { - -class SmallBlocks : public CHeapObj { - - const static uint _small_block_max_byte_size = sizeof(TreeChunk >); - const static uint _small_block_max_word_size = _small_block_max_byte_size / BytesPerWord; - STATIC_ASSERT(_small_block_max_word_size * BytesPerWord == _small_block_max_byte_size); - - // Note: this corresponds to the imposed miminum allocation size, see SpaceManager::get_allocation_word_size() - const static uint _small_block_min_byte_size = sizeof(Metablock); - const static uint _small_block_min_word_size = _small_block_min_byte_size / BytesPerWord; - STATIC_ASSERT(_small_block_min_word_size * BytesPerWord == _small_block_min_byte_size); - -private: - FreeList _small_lists[_small_block_max_word_size - _small_block_min_word_size]; - - FreeList& list_at(size_t word_size) { - assert(word_size >= _small_block_min_word_size, "There are no metaspace objects less than %u words", _small_block_min_word_size); - return _small_lists[word_size - _small_block_min_word_size]; - } - -public: - SmallBlocks() { - for (uint i = _small_block_min_word_size; i < _small_block_max_word_size; i++) { - uint k = i - _small_block_min_word_size; - _small_lists[k].set_size(i); - } - } - - // Returns the total size, in words, of all blocks, across all block sizes. - size_t total_size() const; - - // Returns the total number of all blocks across all block sizes. - uintx total_num_blocks() const; - - static uint small_block_max_byte_size() { return _small_block_max_byte_size; } - static uint small_block_max_word_size() { return _small_block_max_word_size; } - static uint small_block_min_byte_size() { return _small_block_min_byte_size; } - static uint small_block_min_word_size() { return _small_block_min_word_size; } - - MetaWord* get_block(size_t word_size) { - if (list_at(word_size).count() > 0) { - MetaWord* new_block = (MetaWord*) list_at(word_size).get_chunk_at_head(); - return new_block; - } else { - return NULL; - } - } - void return_block(Metablock* free_chunk, size_t word_size) { - list_at(word_size).return_chunk_at_head(free_chunk, false); - assert(list_at(word_size).count() > 0, "Should have a chunk"); - } - - void print_on(outputStream* st) const; - -}; - -} // namespace metaspace - - -#endif // SHARE_MEMORY_METASPACE_SMALLBLOCKS_HPP diff -r de02f487a78a -r 718a09a872d0 src/hotspot/share/memory/metaspace/spaceManager.cpp --- a/src/hotspot/share/memory/metaspace/spaceManager.cpp Fri Mar 01 13:59:26 2019 +0100 +++ b/src/hotspot/share/memory/metaspace/spaceManager.cpp Fri Nov 29 18:21:05 2019 +0100 @@ -26,7 +26,6 @@ #include "logging/log.hpp" #include "logging/logStream.hpp" -#include "memory/metaspace/blockFreelist.hpp" #include "memory/metaspace/chunkManager.hpp" #include "memory/metaspace/internStat.hpp" #include "memory/metaspace/leftOverBins.inline.hpp" @@ -34,7 +33,6 @@ #include "memory/metaspace/metaDebug.hpp" #include "memory/metaspace/metaspaceCommon.hpp" #include "memory/metaspace/metaspaceStatistics.hpp" -#include "memory/metaspace/smallBlocks.hpp" #include "memory/metaspace/spaceManager.hpp" #include "memory/metaspace/virtualSpaceList.hpp" #include "runtime/atomic.hpp" @@ -61,11 +59,14 @@ //static size_t get_raw_allocation_word_size(size_t net_word_size) { + STATIC_ASSERT(Metachunk::allocation_alignment_bytes == (size_t)KlassAlignmentInBytes); + size_t byte_size = net_word_size * BytesPerWord; - byte_size = MAX2(byte_size, (size_t)SmallBlocks::small_block_min_byte_size()); + byte_size = MAX2(byte_size, LeftOverManager::minimal_word_size()); byte_size = align_up(byte_size, Metachunk::allocation_alignment_bytes); size_t word_size = byte_size / BytesPerWord; + assert(word_size * BytesPerWord == byte_size, "Sanity"); return word_size; @@ -80,7 +81,7 @@ size_t byte_size = raw_word_size * BytesPerWord; byte_size = align_down(byte_size, Metachunk::allocation_alignment_bytes); - if (byte_size < SmallBlocks::small_block_min_byte_size()) { + if (byte_size < LeftOverManager::minimal_word_size()) { return 0; } return byte_size / BytesPerWord; @@ -147,19 +148,6 @@ } -void SpaceManager::create_block_freelist() { - assert(_block_freelist == NULL, "Only call once"); - _block_freelist = new BlockFreelist(); -} - -void SpaceManager::add_allocation_to_block_freelist(MetaWord* p, size_t word_size) { - if (_block_freelist == NULL) { - _block_freelist = new BlockFreelist(); // Create only on demand - } - _block_freelist->return_block(p, word_size); -} - - void SpaceManager::create_lom() { assert(_lom == NULL, "Only call once"); _lom = new LeftOverManager(); @@ -182,7 +170,7 @@ _chunk_manager(chunk_manager), _chunk_alloc_sequence(alloc_sequence), _chunks(), - _block_freelist(NULL), _lom(NULL), + _lom(NULL), _total_used_words_counter(total_used_words_counter), _name(name), _is_micro_loader(is_micro_loader) @@ -205,7 +193,6 @@ DEBUG_ONLY(chunk_manager()->verify(true);) - delete _block_freelist; delete _lom; } @@ -247,11 +234,7 @@ MetaWord* ptr = c->allocate(net_remaining_words, &did_hit_limit); assert(ptr != NULL && did_hit_limit == false, "Should have worked"); - if (Settings::use_lom()) { - add_allocation_to_lom(ptr, net_remaining_words); - } else { - add_allocation_to_block_freelist(ptr, net_remaining_words); - } + add_allocation_to_lom(ptr, net_remaining_words); _total_used_words_counter->increment_by(net_remaining_words); @@ -297,28 +280,8 @@ } // 1) Attempt to allocate from the dictionary of deallocated blocks. - - // Allocation from the dictionary is expensive in the sense that - // the dictionary has to be searched for a size. Don't allocate - // from the dictionary until it starts to get fat. Is this - // a reasonable policy? Maybe an skinny dictionary is fast enough - // for allocations. Do some profiling. JJJ - if (Settings::use_lom()) { - if (_lom != NULL) { - p = _lom->get_block(raw_word_size); - if (p != NULL) { - DEBUG_ONLY(InternalStats::inc_num_allocs_from_deallocated_blocks();) - log_trace(metaspace)(LOGFMT_SPCMGR ": .. taken from freelist.", LOGFMT_SPCMGR_ARGS); - // Note: space in the freeblock dictionary counts as used (see retire_current_chunk()) - - // that means that we must not increase the used counter again when allocating from the dictionary. - // Therefore we return here. - return p; - } - } - } else { - if (_block_freelist != NULL && _block_freelist->total_size() > Settings::allocation_from_dictionary_limit()) { - p = _block_freelist->get_block(raw_word_size); - + if (_lom != NULL) { + p = _lom->get_block(raw_word_size); if (p != NULL) { DEBUG_ONLY(InternalStats::inc_num_allocs_from_deallocated_blocks();) log_trace(metaspace)(LOGFMT_SPCMGR ": .. taken from freelist.", LOGFMT_SPCMGR_ARGS); @@ -327,8 +290,6 @@ // Therefore we return here. return p; } - - } } // 2) Failing that, attempt to allocate from the current chunk. If we hit commit limit, return NULL. @@ -441,11 +402,7 @@ return; } - if (Settings::use_lom()) { - add_allocation_to_lom(p, raw_word_size); - } else { - add_allocation_to_block_freelist(p, raw_word_size); - } + add_allocation_to_lom(p, raw_word_size); DEBUG_ONLY(verify_locked();) @@ -477,18 +434,11 @@ } } - if (Settings::use_lom()) { - if (lom() != NULL) { - block_stats_t s; - lom()->statistics(&s); - out->free_blocks_num += s.num_blocks; - out->free_blocks_word_size += s.word_size; - } - } else { - if (block_freelist() != NULL) { - out->free_blocks_num += block_freelist()->num_blocks(); - out->free_blocks_word_size += block_freelist()->total_size(); - } + if (lom() != NULL) { + block_stats_t s; + lom()->statistics(&s); + out->free_blocks_num += s.num_blocks; + out->free_blocks_word_size += s.word_size; } SOMETIMES(out->verify();) @@ -505,10 +455,8 @@ _chunks.verify(); - if (Settings::use_lom()) { - if (lom() != NULL) { - lom()->verify(); - } + if (lom() != NULL) { + lom()->verify(); } } diff -r de02f487a78a -r 718a09a872d0 src/hotspot/share/memory/metaspace/spaceManager.hpp --- a/src/hotspot/share/memory/metaspace/spaceManager.hpp Fri Mar 01 13:59:26 2019 +0100 +++ b/src/hotspot/share/memory/metaspace/spaceManager.hpp Fri Nov 29 18:21:05 2019 +0100 @@ -28,7 +28,6 @@ #include "memory/allocation.hpp" #include "memory/metaspace.hpp" -#include "memory/metaspace/blockFreelist.hpp" #include "memory/metaspace/chunkAllocSequence.hpp" #include "memory/metaspace/chunkManager.hpp" #include "memory/metaspace/metachunk.hpp" @@ -40,7 +39,6 @@ namespace metaspace { -class BlockFreeList; class LeftOverManager; struct sm_stats_t; @@ -69,17 +67,12 @@ // chunks when the SpaceManager is freed. MetachunkList _chunks; + // Structure to take care of leftover/deallocated space in used chunks + LeftOverManager* _lom; + Metachunk* current_chunk() { return _chunks.first(); } const Metachunk* current_chunk() const { return _chunks.first(); } - // These structures take care of 1) prematurely deallocated Metaspace blocks - // and 2) leftover space from retired chunks. - // Only one of these is active; one will eventually go. We are still testing - // which implementation is better suited to the task. _lom is default. Change - // with -XX:+-MetaspaceUseLOM. - BlockFreelist* _block_freelist; - LeftOverManager* _lom; - // Points to outside size counter which we are to increase/decrease when we allocate memory // on behalf of a user or when we are destroyed. SizeAtomicCounter* const _total_used_words_counter; @@ -93,7 +86,6 @@ ChunkManager* chunk_manager() const { return _chunk_manager; } const ChunkAllocSequence* chunk_alloc_sequence() const { return _chunk_alloc_sequence; } - BlockFreelist* block_freelist() const { return _block_freelist; } void create_block_freelist(); void add_allocation_to_block_freelist(MetaWord* p, size_t word_size); diff -r de02f487a78a -r 718a09a872d0 src/hotspot/share/runtime/globals.hpp --- a/src/hotspot/share/runtime/globals.hpp Fri Mar 01 13:59:26 2019 +0100 +++ b/src/hotspot/share/runtime/globals.hpp Fri Nov 29 18:21:05 2019 +0100 @@ -1639,9 +1639,6 @@ product(bool, MetaspaceEnlargeChunksInPlace, true, \ "Metapace chunks are enlarged in place.") \ \ - product(bool, MetaspaceUseLOM, true, \ - "MetaspaceUseLOM.") \ - \ manageable(uintx, MinHeapFreeRatio, 40, \ "The minimum percentage of heap free after GC to avoid expansion."\ " For most GCs this applies to the old generation. In G1 and" \