changeset 4588:601183f604b2

8013129: Possible deadlock with Metaspace locks due to mixed usage of safepoint aware and non-safepoint aware locking Summary: Change Metaspace::deallocate to take lock with _no_safepoint_check_flag Reviewed-by: coleenp, jmasa, dholmes
author mgerdin
date Mon, 29 Apr 2013 13:07:27 +0200
parents caac22686b17
children 9075044ed66b
files src/share/vm/memory/metaspace.cpp
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/memory/metaspace.cpp	Mon Apr 29 09:31:59 2013 +0200
+++ b/src/share/vm/memory/metaspace.cpp	Mon Apr 29 13:07:27 2013 +0200
@@ -2945,7 +2945,7 @@
   if (SafepointSynchronize::is_at_safepoint()) {
     assert(Thread::current()->is_VM_thread(), "should be the VM thread");
     // 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()) {
       // Dark matter.  Too small for dictionary.
 #ifdef ASSERT
@@ -2959,7 +2959,7 @@
       vsm()->deallocate(ptr, word_size);
     }
   } else {
-    MutexLocker ml(vsm()->lock());
+    MutexLockerEx ml(vsm()->lock(), Mutex::_no_safepoint_check_flag);
 
     if (word_size < TreeChunk<Metablock, FreeList>::min_size()) {
       // Dark matter.  Too small for dictionary.