mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 19:14:38 +02:00
8013129: Possible deadlock with Metaspace locks due to mixed usage of safepoint aware and non-safepoint aware locking
Change Metaspace::deallocate to take lock with _no_safepoint_check_flag Reviewed-by: coleenp, jmasa, dholmes
This commit is contained in:
parent
fa84ba4ba9
commit
40531b2009
1 changed files with 2 additions and 2 deletions
|
@ -2945,7 +2945,7 @@ void Metaspace::deallocate(MetaWord* ptr, size_t word_size, bool is_class) {
|
||||||
if (SafepointSynchronize::is_at_safepoint()) {
|
if (SafepointSynchronize::is_at_safepoint()) {
|
||||||
assert(Thread::current()->is_VM_thread(), "should be the VM thread");
|
assert(Thread::current()->is_VM_thread(), "should be the VM thread");
|
||||||
// Don't take Heap_lock
|
// Don't take Heap_lock
|
||||||
MutexLocker ml(vsm()->lock());
|
MutexLockerEx ml(vsm()->lock(), Mutex::_no_safepoint_check_flag);
|
||||||
if (word_size < TreeChunk<Metablock, FreeList>::min_size()) {
|
if (word_size < TreeChunk<Metablock, FreeList>::min_size()) {
|
||||||
// Dark matter. Too small for dictionary.
|
// Dark matter. Too small for dictionary.
|
||||||
#ifdef ASSERT
|
#ifdef ASSERT
|
||||||
|
@ -2959,7 +2959,7 @@ void Metaspace::deallocate(MetaWord* ptr, size_t word_size, bool is_class) {
|
||||||
vsm()->deallocate(ptr, word_size);
|
vsm()->deallocate(ptr, word_size);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
MutexLocker ml(vsm()->lock());
|
MutexLockerEx ml(vsm()->lock(), Mutex::_no_safepoint_check_flag);
|
||||||
|
|
||||||
if (word_size < TreeChunk<Metablock, FreeList>::min_size()) {
|
if (word_size < TreeChunk<Metablock, FreeList>::min_size()) {
|
||||||
// Dark matter. Too small for dictionary.
|
// Dark matter. Too small for dictionary.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue