changeset 1078:95e9083cf4a7

6822370: ReentrantReadWriteLock: threads hung when there are no threads holding onto the lock (Netra x4450) Summary: This day one bug is caused by missing memory barriers in various Parker::park() paths that can result in lost wakeups and hangs. Reviewed-by: dice, acorn
author dholmes
date Tue, 01 Dec 2009 22:29:02 -0500
parents 4b966d9946a3
children 3115100553b5
files src/os/linux/vm/os_linux.cpp src/os/solaris/vm/os_solaris.cpp
diffstat 2 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/os/linux/vm/os_linux.cpp	Wed Nov 25 08:37:04 2009 -0800
+++ b/src/os/linux/vm/os_linux.cpp	Tue Dec 01 22:29:02 2009 -0500
@@ -4683,6 +4683,7 @@
   // Return immediately if a permit is available.
   if (_counter > 0) {
       _counter = 0 ;
+      OrderAccess::fence();
       return ;
   }
 
@@ -4725,6 +4726,7 @@
     _counter = 0;
     status = pthread_mutex_unlock(_mutex);
     assert (status == 0, "invariant") ;
+    OrderAccess::fence();
     return;
   }
 
@@ -4765,6 +4767,7 @@
     jt->java_suspend_self();
   }
 
+  OrderAccess::fence();
 }
 
 void Parker::unpark() {
--- a/src/os/solaris/vm/os_solaris.cpp	Wed Nov 25 08:37:04 2009 -0800
+++ b/src/os/solaris/vm/os_solaris.cpp	Tue Dec 01 22:29:02 2009 -0500
@@ -5803,6 +5803,7 @@
   // Return immediately if a permit is available.
   if (_counter > 0) {
       _counter = 0 ;
+      OrderAccess::fence();
       return ;
   }
 
@@ -5846,6 +5847,7 @@
     _counter = 0;
     status = os::Solaris::mutex_unlock(_mutex);
     assert (status == 0, "invariant") ;
+    OrderAccess::fence();
     return;
   }
 
@@ -5892,6 +5894,7 @@
     jt->java_suspend_self();
   }
 
+  OrderAccess::fence();
 }
 
 void Parker::unpark() {