Patchwork libitm: Don't enforce privatization safety if already in serial mode.

login
register
mail settings
Submitter Torvald Riegel
Date Dec. 22, 2011, 7:46 p.m.
Message ID <1324583173.4159.16788.camel@triegel.csb>
Download mbox | patch
Permalink /patch/132893/
State New
Headers show

Comments

Torvald Riegel - Dec. 22, 2011, 7:46 p.m.
Noticed this while looking at the privatization safety code.  If we're
already in serial mode, there is no other active transaction that could
have pending reads or writes, so there is also no need to enforce/check
that there is no other active txn.  This is not triggered with the
current set of TM methods, but better to add this now than get hit by
the overhead later.

OK for trunk?
commit b3756d728ba89b67e059abca407937291cc13881
Author: Torvald Riegel <triegel@redhat.com>
Date:   Thu Dec 22 20:42:15 2011 +0100

    libitm: Don't enforce privatization safety if already in serial mode.
    
    	libitm/
    	* beginend.cc (GTM::gtm_thread::trycommit): Don't enforce
    	privatization safety if already in serial mode.
Richard Henderson - Dec. 22, 2011, 8:13 p.m.
On 12/22/2011 11:46 AM, Torvald Riegel wrote:
>     libitm: Don't enforce privatization safety if already in serial mode.
>     
>     	libitm/
>     	* beginend.cc (GTM::gtm_thread::trycommit): Don't enforce
>     	privatization safety if already in serial mode.

Ok.

r~

Patch

diff --git a/libitm/beginend.cc b/libitm/beginend.cc
index 17f9d74..7975481 100644
--- a/libitm/beginend.cc
+++ b/libitm/beginend.cc
@@ -457,7 +457,12 @@  GTM::gtm_thread::trycommit ()
       // The transaction is now inactive. Everything that we still have to do
       // will not synchronize with other transactions anymore.
       if (state & gtm_thread::STATE_SERIAL)
-	gtm_thread::serial_lock.write_unlock ();
+        {
+          gtm_thread::serial_lock.write_unlock ();
+          // There are no other active transactions, so there's no need to
+          // enforce privatization safety.
+          priv_time = 0;
+        }
       else
 	gtm_thread::serial_lock.read_unlock (this);
       state = 0;