mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-21 19:44:41 +02:00
8026715: Remove the MetaDataDeallocateALot develop flag
Reviewed-by: coleenp, mgerdin
This commit is contained in:
parent
7bf2a9861b
commit
79199b95bc
2 changed files with 1 additions and 120 deletions
|
@ -52,9 +52,6 @@ typedef BinaryTreeDictionary<Metachunk, FreeList> ChunkTreeDictionary;
|
||||||
// Set this constant to enable slow integrity checking of the free chunk lists
|
// Set this constant to enable slow integrity checking of the free chunk lists
|
||||||
const bool metaspace_slow_verify = false;
|
const bool metaspace_slow_verify = false;
|
||||||
|
|
||||||
// Parameters for stress mode testing
|
|
||||||
const uint metadata_deallocate_a_lot_block = 10;
|
|
||||||
const uint metadata_deallocate_a_lock_chunk = 3;
|
|
||||||
size_t const allocation_from_dictionary_limit = 4 * K;
|
size_t const allocation_from_dictionary_limit = 4 * K;
|
||||||
|
|
||||||
MetaWord* last_allocated = 0;
|
MetaWord* last_allocated = 0;
|
||||||
|
@ -149,7 +146,6 @@ class ChunkManager : public CHeapObj<mtInternal> {
|
||||||
|
|
||||||
// add or delete (return) a chunk to the global freelist.
|
// add or delete (return) a chunk to the global freelist.
|
||||||
Metachunk* chunk_freelist_allocate(size_t word_size);
|
Metachunk* chunk_freelist_allocate(size_t word_size);
|
||||||
void chunk_freelist_deallocate(Metachunk* chunk);
|
|
||||||
|
|
||||||
// Map a size to a list index assuming that there are lists
|
// Map a size to a list index assuming that there are lists
|
||||||
// for special, small, medium, and humongous chunks.
|
// for special, small, medium, and humongous chunks.
|
||||||
|
@ -183,9 +179,7 @@ class ChunkManager : public CHeapObj<mtInternal> {
|
||||||
// Returns the list for the given chunk word size.
|
// Returns the list for the given chunk word size.
|
||||||
ChunkList* find_free_chunks_list(size_t word_size);
|
ChunkList* find_free_chunks_list(size_t word_size);
|
||||||
|
|
||||||
// Add and remove from a list by size. Selects
|
// Remove from a list by size. Selects list based on size of chunk.
|
||||||
// list based on size of chunk.
|
|
||||||
void free_chunks_put(Metachunk* chuck);
|
|
||||||
Metachunk* free_chunks_get(size_t chunk_word_size);
|
Metachunk* free_chunks_get(size_t chunk_word_size);
|
||||||
|
|
||||||
// Debug support
|
// Debug support
|
||||||
|
@ -533,44 +527,16 @@ class VirtualSpaceList : public CHeapObj<mtClass> {
|
||||||
|
|
||||||
class Metadebug : AllStatic {
|
class Metadebug : AllStatic {
|
||||||
// Debugging support for Metaspaces
|
// Debugging support for Metaspaces
|
||||||
static int _deallocate_block_a_lot_count;
|
|
||||||
static int _deallocate_chunk_a_lot_count;
|
|
||||||
static int _allocation_fail_alot_count;
|
static int _allocation_fail_alot_count;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static int deallocate_block_a_lot_count() {
|
|
||||||
return _deallocate_block_a_lot_count;
|
|
||||||
}
|
|
||||||
static void set_deallocate_block_a_lot_count(int v) {
|
|
||||||
_deallocate_block_a_lot_count = v;
|
|
||||||
}
|
|
||||||
static void inc_deallocate_block_a_lot_count() {
|
|
||||||
_deallocate_block_a_lot_count++;
|
|
||||||
}
|
|
||||||
static int deallocate_chunk_a_lot_count() {
|
|
||||||
return _deallocate_chunk_a_lot_count;
|
|
||||||
}
|
|
||||||
static void reset_deallocate_chunk_a_lot_count() {
|
|
||||||
_deallocate_chunk_a_lot_count = 1;
|
|
||||||
}
|
|
||||||
static void inc_deallocate_chunk_a_lot_count() {
|
|
||||||
_deallocate_chunk_a_lot_count++;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void init_allocation_fail_alot_count();
|
static void init_allocation_fail_alot_count();
|
||||||
#ifdef ASSERT
|
#ifdef ASSERT
|
||||||
static bool test_metadata_failure();
|
static bool test_metadata_failure();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void deallocate_chunk_a_lot(SpaceManager* sm,
|
|
||||||
size_t chunk_word_size);
|
|
||||||
static void deallocate_block_a_lot(SpaceManager* sm,
|
|
||||||
size_t chunk_word_size);
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
int Metadebug::_deallocate_block_a_lot_count = 0;
|
|
||||||
int Metadebug::_deallocate_chunk_a_lot_count = 0;
|
|
||||||
int Metadebug::_allocation_fail_alot_count = 0;
|
int Metadebug::_allocation_fail_alot_count = 0;
|
||||||
|
|
||||||
// SpaceManager - used by Metaspace to handle allocations
|
// SpaceManager - used by Metaspace to handle allocations
|
||||||
|
@ -1534,54 +1500,6 @@ void MetaspaceGC::compute_new_size() {
|
||||||
|
|
||||||
// Metadebug methods
|
// Metadebug methods
|
||||||
|
|
||||||
void Metadebug::deallocate_chunk_a_lot(SpaceManager* sm,
|
|
||||||
size_t chunk_word_size){
|
|
||||||
#ifdef ASSERT
|
|
||||||
VirtualSpaceList* vsl = sm->vs_list();
|
|
||||||
if (MetaDataDeallocateALot &&
|
|
||||||
Metadebug::deallocate_chunk_a_lot_count() % MetaDataDeallocateALotInterval == 0 ) {
|
|
||||||
Metadebug::reset_deallocate_chunk_a_lot_count();
|
|
||||||
for (uint i = 0; i < metadata_deallocate_a_lock_chunk; i++) {
|
|
||||||
Metachunk* dummy_chunk = vsl->current_virtual_space()->take_from_committed(chunk_word_size);
|
|
||||||
if (dummy_chunk == NULL) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
sm->chunk_manager()->chunk_freelist_deallocate(dummy_chunk);
|
|
||||||
|
|
||||||
if (TraceMetadataChunkAllocation && Verbose) {
|
|
||||||
gclog_or_tty->print("Metadebug::deallocate_chunk_a_lot: %d) ",
|
|
||||||
sm->sum_count_in_chunks_in_use());
|
|
||||||
dummy_chunk->print_on(gclog_or_tty);
|
|
||||||
gclog_or_tty->print_cr(" Free chunks total %d count %d",
|
|
||||||
sm->chunk_manager()->free_chunks_total_words(),
|
|
||||||
sm->chunk_manager()->free_chunks_count());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Metadebug::inc_deallocate_chunk_a_lot_count();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void Metadebug::deallocate_block_a_lot(SpaceManager* sm,
|
|
||||||
size_t raw_word_size){
|
|
||||||
#ifdef ASSERT
|
|
||||||
if (MetaDataDeallocateALot &&
|
|
||||||
Metadebug::deallocate_block_a_lot_count() % MetaDataDeallocateALotInterval == 0 ) {
|
|
||||||
Metadebug::set_deallocate_block_a_lot_count(0);
|
|
||||||
for (uint i = 0; i < metadata_deallocate_a_lot_block; i++) {
|
|
||||||
MetaWord* dummy_block = sm->allocate_work(raw_word_size);
|
|
||||||
if (dummy_block == 0) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
sm->deallocate(dummy_block, raw_word_size);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Metadebug::inc_deallocate_block_a_lot_count();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void Metadebug::init_allocation_fail_alot_count() {
|
void Metadebug::init_allocation_fail_alot_count() {
|
||||||
if (MetadataAllocationFailALot) {
|
if (MetadataAllocationFailALot) {
|
||||||
_allocation_fail_alot_count =
|
_allocation_fail_alot_count =
|
||||||
|
@ -1725,31 +1643,6 @@ ChunkList* ChunkManager::find_free_chunks_list(size_t word_size) {
|
||||||
return free_chunks(index);
|
return free_chunks(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChunkManager::free_chunks_put(Metachunk* chunk) {
|
|
||||||
assert_lock_strong(SpaceManager::expand_lock());
|
|
||||||
ChunkList* free_list = find_free_chunks_list(chunk->word_size());
|
|
||||||
chunk->set_next(free_list->head());
|
|
||||||
free_list->set_head(chunk);
|
|
||||||
// chunk is being returned to the chunk free list
|
|
||||||
inc_free_chunks_total(chunk->word_size());
|
|
||||||
slow_locked_verify();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ChunkManager::chunk_freelist_deallocate(Metachunk* chunk) {
|
|
||||||
// The deallocation of a chunk originates in the freelist
|
|
||||||
// manangement code for a Metaspace and does not hold the
|
|
||||||
// lock.
|
|
||||||
assert(chunk != NULL, "Deallocating NULL");
|
|
||||||
assert_lock_strong(SpaceManager::expand_lock());
|
|
||||||
slow_locked_verify();
|
|
||||||
if (TraceMetadataChunkAllocation) {
|
|
||||||
gclog_or_tty->print_cr("ChunkManager::chunk_freelist_deallocate: chunk "
|
|
||||||
PTR_FORMAT " size " SIZE_FORMAT,
|
|
||||||
chunk, chunk->word_size());
|
|
||||||
}
|
|
||||||
free_chunks_put(chunk);
|
|
||||||
}
|
|
||||||
|
|
||||||
Metachunk* ChunkManager::free_chunks_get(size_t word_size) {
|
Metachunk* ChunkManager::free_chunks_get(size_t word_size) {
|
||||||
assert_lock_strong(SpaceManager::expand_lock());
|
assert_lock_strong(SpaceManager::expand_lock());
|
||||||
|
|
||||||
|
@ -2069,10 +1962,6 @@ MetaWord* SpaceManager::grow_and_allocate(size_t word_size) {
|
||||||
size_t grow_chunks_by_words = calc_chunk_size(word_size);
|
size_t grow_chunks_by_words = calc_chunk_size(word_size);
|
||||||
Metachunk* next = get_new_chunk(word_size, grow_chunks_by_words);
|
Metachunk* next = get_new_chunk(word_size, grow_chunks_by_words);
|
||||||
|
|
||||||
if (next != NULL) {
|
|
||||||
Metadebug::deallocate_chunk_a_lot(this, grow_chunks_by_words);
|
|
||||||
}
|
|
||||||
|
|
||||||
MetaWord* mem = NULL;
|
MetaWord* mem = NULL;
|
||||||
|
|
||||||
// If a chunk was available, add it to the in-use chunk list
|
// If a chunk was available, add it to the in-use chunk list
|
||||||
|
@ -2417,7 +2306,6 @@ MetaWord* SpaceManager::allocate(size_t word_size) {
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
p = allocate_work(raw_word_size);
|
p = allocate_work(raw_word_size);
|
||||||
}
|
}
|
||||||
Metadebug::deallocate_block_a_lot(this, raw_word_size);
|
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1979,13 +1979,6 @@ class CommandLineFlags {
|
||||||
develop(uintx, MetadataAllocationFailALotInterval, 1000, \
|
develop(uintx, MetadataAllocationFailALotInterval, 1000, \
|
||||||
"Metadata allocation failure a lot interval") \
|
"Metadata allocation failure a lot interval") \
|
||||||
\
|
\
|
||||||
develop(bool, MetaDataDeallocateALot, false, \
|
|
||||||
"Deallocation bunches of metadata at intervals controlled by " \
|
|
||||||
"MetaDataAllocateALotInterval") \
|
|
||||||
\
|
|
||||||
develop(uintx, MetaDataDeallocateALotInterval, 100, \
|
|
||||||
"Metadata deallocation alot interval") \
|
|
||||||
\
|
|
||||||
develop(bool, TraceMetadataChunkAllocation, false, \
|
develop(bool, TraceMetadataChunkAllocation, false, \
|
||||||
"Trace chunk metadata allocations") \
|
"Trace chunk metadata allocations") \
|
||||||
\
|
\
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue