8315378: [BACKOUT] runtime/NMT/SummarySanityCheck.java failed with "Total committed (MMMMMM) did not match the summarized committed (NNNNNN)"
Reviewed-by: stuefe, ccheung
This commit is contained in:
parent
c12ca885cc
commit
351c31ea58
src/hotspot/share/services
@ -70,30 +70,6 @@ size_t MallocMemorySnapshot::total_arena() const {
|
||||
return amount;
|
||||
}
|
||||
|
||||
void MallocMemorySnapshot::copy_to(MallocMemorySnapshot* s) {
|
||||
// Need to make sure that mtChunks don't get deallocated while the
|
||||
// copy is going on, because their size is adjusted using this
|
||||
// buffer in make_adjustment().
|
||||
ThreadCritical tc;
|
||||
size_t total_size;
|
||||
size_t loop_counter = 0;
|
||||
const size_t loop_limit = 100;
|
||||
// It is observed that other threads can allocate during the loop of copying.
|
||||
// This results in inconsistent total and sum of parts. So, the while-loop and
|
||||
// the local total_size are used to find and try again a limited number of times.
|
||||
// Acheiving fully consistent total and sum of parts requires to block all mallooc's during
|
||||
// the copy which is a performance obstacle.
|
||||
do {
|
||||
total_size = 0;
|
||||
s->_all_mallocs = _all_mallocs;
|
||||
for (int index = 0; index < mt_number_of_types; index ++) {
|
||||
s->_malloc[index] = _malloc[index];
|
||||
total_size += _malloc[index].malloc_size();
|
||||
}
|
||||
} while(s->_all_mallocs.size() != total_size && ++loop_counter < loop_limit);
|
||||
assert(s->_all_mallocs.size() == total_size, "Total != sum of parts");
|
||||
}
|
||||
|
||||
// Make adjustment by subtracting chunks used by arenas
|
||||
// from total chunks to get total free chunk size
|
||||
void MallocMemorySnapshot::make_adjustment() {
|
||||
|
@ -186,7 +186,16 @@ class MallocMemorySnapshot : public ResourceObj {
|
||||
return s->by_type(mtThreadStack)->malloc_count();
|
||||
}
|
||||
|
||||
void copy_to(MallocMemorySnapshot* s);
|
||||
void copy_to(MallocMemorySnapshot* s) {
|
||||
// Need to make sure that mtChunks don't get deallocated while the
|
||||
// copy is going on, because their size is adjusted using this
|
||||
// buffer in make_adjustment().
|
||||
ThreadCritical tc;
|
||||
s->_all_mallocs = _all_mallocs;
|
||||
for (int index = 0; index < mt_number_of_types; index ++) {
|
||||
s->_malloc[index] = _malloc[index];
|
||||
}
|
||||
}
|
||||
|
||||
// Make adjustment by subtracting chunks used by arenas
|
||||
// from total chunks to get total free chunk size
|
||||
|
Loading…
x
Reference in New Issue
Block a user