1.1 --- a/src/share/vm/memory/metaspace.cpp Thu Oct 17 08:41:35 2013 +0200 1.2 +++ b/src/share/vm/memory/metaspace.cpp Thu Oct 17 08:42:41 2013 +0200 1.3 @@ -52,9 +52,6 @@ 1.4 // Set this constant to enable slow integrity checking of the free chunk lists 1.5 const bool metaspace_slow_verify = false; 1.6 1.7 -// Parameters for stress mode testing 1.8 -const uint metadata_deallocate_a_lot_block = 10; 1.9 -const uint metadata_deallocate_a_lock_chunk = 3; 1.10 size_t const allocation_from_dictionary_limit = 4 * K; 1.11 1.12 MetaWord* last_allocated = 0; 1.13 @@ -149,7 +146,6 @@ 1.14 1.15 // add or delete (return) a chunk to the global freelist. 1.16 Metachunk* chunk_freelist_allocate(size_t word_size); 1.17 - void chunk_freelist_deallocate(Metachunk* chunk); 1.18 1.19 // Map a size to a list index assuming that there are lists 1.20 // for special, small, medium, and humongous chunks. 1.21 @@ -183,9 +179,7 @@ 1.22 // Returns the list for the given chunk word size. 1.23 ChunkList* find_free_chunks_list(size_t word_size); 1.24 1.25 - // Add and remove from a list by size. Selects 1.26 - // list based on size of chunk. 1.27 - void free_chunks_put(Metachunk* chuck); 1.28 + // Remove from a list by size. Selects list based on size of chunk. 1.29 Metachunk* free_chunks_get(size_t chunk_word_size); 1.30 1.31 // Debug support 1.32 @@ -533,44 +527,16 @@ 1.33 1.34 class Metadebug : AllStatic { 1.35 // Debugging support for Metaspaces 1.36 - static int _deallocate_block_a_lot_count; 1.37 - static int _deallocate_chunk_a_lot_count; 1.38 static int _allocation_fail_alot_count; 1.39 1.40 public: 1.41 - static int deallocate_block_a_lot_count() { 1.42 - return _deallocate_block_a_lot_count; 1.43 - } 1.44 - static void set_deallocate_block_a_lot_count(int v) { 1.45 - _deallocate_block_a_lot_count = v; 1.46 - } 1.47 - static void inc_deallocate_block_a_lot_count() { 1.48 - _deallocate_block_a_lot_count++; 1.49 - } 1.50 - static int deallocate_chunk_a_lot_count() { 1.51 - return _deallocate_chunk_a_lot_count; 1.52 - } 1.53 - static void reset_deallocate_chunk_a_lot_count() { 1.54 - _deallocate_chunk_a_lot_count = 1; 1.55 - } 1.56 - static void inc_deallocate_chunk_a_lot_count() { 1.57 - _deallocate_chunk_a_lot_count++; 1.58 - } 1.59 1.60 static void init_allocation_fail_alot_count(); 1.61 #ifdef ASSERT 1.62 static bool test_metadata_failure(); 1.63 #endif 1.64 - 1.65 - static void deallocate_chunk_a_lot(SpaceManager* sm, 1.66 - size_t chunk_word_size); 1.67 - static void deallocate_block_a_lot(SpaceManager* sm, 1.68 - size_t chunk_word_size); 1.69 - 1.70 }; 1.71 1.72 -int Metadebug::_deallocate_block_a_lot_count = 0; 1.73 -int Metadebug::_deallocate_chunk_a_lot_count = 0; 1.74 int Metadebug::_allocation_fail_alot_count = 0; 1.75 1.76 // SpaceManager - used by Metaspace to handle allocations 1.77 @@ -1534,54 +1500,6 @@ 1.78 1.79 // Metadebug methods 1.80 1.81 -void Metadebug::deallocate_chunk_a_lot(SpaceManager* sm, 1.82 - size_t chunk_word_size){ 1.83 -#ifdef ASSERT 1.84 - VirtualSpaceList* vsl = sm->vs_list(); 1.85 - if (MetaDataDeallocateALot && 1.86 - Metadebug::deallocate_chunk_a_lot_count() % MetaDataDeallocateALotInterval == 0 ) { 1.87 - Metadebug::reset_deallocate_chunk_a_lot_count(); 1.88 - for (uint i = 0; i < metadata_deallocate_a_lock_chunk; i++) { 1.89 - Metachunk* dummy_chunk = vsl->current_virtual_space()->take_from_committed(chunk_word_size); 1.90 - if (dummy_chunk == NULL) { 1.91 - break; 1.92 - } 1.93 - sm->chunk_manager()->chunk_freelist_deallocate(dummy_chunk); 1.94 - 1.95 - if (TraceMetadataChunkAllocation && Verbose) { 1.96 - gclog_or_tty->print("Metadebug::deallocate_chunk_a_lot: %d) ", 1.97 - sm->sum_count_in_chunks_in_use()); 1.98 - dummy_chunk->print_on(gclog_or_tty); 1.99 - gclog_or_tty->print_cr(" Free chunks total %d count %d", 1.100 - sm->chunk_manager()->free_chunks_total_words(), 1.101 - sm->chunk_manager()->free_chunks_count()); 1.102 - } 1.103 - } 1.104 - } else { 1.105 - Metadebug::inc_deallocate_chunk_a_lot_count(); 1.106 - } 1.107 -#endif 1.108 -} 1.109 - 1.110 -void Metadebug::deallocate_block_a_lot(SpaceManager* sm, 1.111 - size_t raw_word_size){ 1.112 -#ifdef ASSERT 1.113 - if (MetaDataDeallocateALot && 1.114 - Metadebug::deallocate_block_a_lot_count() % MetaDataDeallocateALotInterval == 0 ) { 1.115 - Metadebug::set_deallocate_block_a_lot_count(0); 1.116 - for (uint i = 0; i < metadata_deallocate_a_lot_block; i++) { 1.117 - MetaWord* dummy_block = sm->allocate_work(raw_word_size); 1.118 - if (dummy_block == 0) { 1.119 - break; 1.120 - } 1.121 - sm->deallocate(dummy_block, raw_word_size); 1.122 - } 1.123 - } else { 1.124 - Metadebug::inc_deallocate_block_a_lot_count(); 1.125 - } 1.126 -#endif 1.127 -} 1.128 - 1.129 void Metadebug::init_allocation_fail_alot_count() { 1.130 if (MetadataAllocationFailALot) { 1.131 _allocation_fail_alot_count = 1.132 @@ -1725,31 +1643,6 @@ 1.133 return free_chunks(index); 1.134 } 1.135 1.136 -void ChunkManager::free_chunks_put(Metachunk* chunk) { 1.137 - assert_lock_strong(SpaceManager::expand_lock()); 1.138 - ChunkList* free_list = find_free_chunks_list(chunk->word_size()); 1.139 - chunk->set_next(free_list->head()); 1.140 - free_list->set_head(chunk); 1.141 - // chunk is being returned to the chunk free list 1.142 - inc_free_chunks_total(chunk->word_size()); 1.143 - slow_locked_verify(); 1.144 -} 1.145 - 1.146 -void ChunkManager::chunk_freelist_deallocate(Metachunk* chunk) { 1.147 - // The deallocation of a chunk originates in the freelist 1.148 - // manangement code for a Metaspace and does not hold the 1.149 - // lock. 1.150 - assert(chunk != NULL, "Deallocating NULL"); 1.151 - assert_lock_strong(SpaceManager::expand_lock()); 1.152 - slow_locked_verify(); 1.153 - if (TraceMetadataChunkAllocation) { 1.154 - gclog_or_tty->print_cr("ChunkManager::chunk_freelist_deallocate: chunk " 1.155 - PTR_FORMAT " size " SIZE_FORMAT, 1.156 - chunk, chunk->word_size()); 1.157 - } 1.158 - free_chunks_put(chunk); 1.159 -} 1.160 - 1.161 Metachunk* ChunkManager::free_chunks_get(size_t word_size) { 1.162 assert_lock_strong(SpaceManager::expand_lock()); 1.163 1.164 @@ -2069,10 +1962,6 @@ 1.165 size_t grow_chunks_by_words = calc_chunk_size(word_size); 1.166 Metachunk* next = get_new_chunk(word_size, grow_chunks_by_words); 1.167 1.168 - if (next != NULL) { 1.169 - Metadebug::deallocate_chunk_a_lot(this, grow_chunks_by_words); 1.170 - } 1.171 - 1.172 MetaWord* mem = NULL; 1.173 1.174 // If a chunk was available, add it to the in-use chunk list 1.175 @@ -2417,7 +2306,6 @@ 1.176 if (p == NULL) { 1.177 p = allocate_work(raw_word_size); 1.178 } 1.179 - Metadebug::deallocate_block_a_lot(this, raw_word_size); 1.180 1.181 return p; 1.182 }