Author: Remi Meier <remi.me...@inf.ethz.ch>
Branch: 
Changeset: r1181:7713ed439985
Date: 2014-04-24 13:47 +0200
http://bitbucket.org/pypy/stmgc/changeset/7713ed439985/

Log:    do not signal a transaction to commit more than once. this is
        necessary to not hurt performance (if this mechanism turns out to be
        useful at all)

diff --git a/c7/stm/contention.c b/c7/stm/contention.c
--- a/c7/stm/contention.c
+++ b/c7/stm/contention.c
@@ -263,7 +263,10 @@
 
         /* we should commit soon, we caused an abort */
         
//signal_other_to_commit_soon(get_priv_segment(STM_SEGMENT->segment_num));
-        stmcb_commit_soon();
+        if (!STM_PSEGMENT->signalled_to_commit_soon) {
+            STM_PSEGMENT->signalled_to_commit_soon = true;
+            stmcb_commit_soon();
+        }
     }
 }
 
diff --git a/c7/stm/core.c b/c7/stm/core.c
--- a/c7/stm/core.c
+++ b/c7/stm/core.c
@@ -192,6 +192,7 @@
     assert(STM_PSEGMENT->transaction_state == TS_NONE);
     change_timing_state(STM_TIME_RUN_CURRENT);
     STM_PSEGMENT->start_time = tl->_timing_cur_start;
+    STM_PSEGMENT->signalled_to_commit_soon = false;
     STM_PSEGMENT->safe_point = SP_RUNNING;
     STM_PSEGMENT->transaction_state = (jmpbuf != NULL ? TS_REGULAR
                                                       : TS_INEVITABLE);
diff --git a/c7/stm/core.h b/c7/stm/core.h
--- a/c7/stm/core.h
+++ b/c7/stm/core.h
@@ -162,6 +162,9 @@
     struct stm_shadowentry_s *shadowstack_at_start_of_transaction;
     object_t *threadlocal_at_start_of_transaction;
 
+    /* Already signalled to commit soon: */
+    bool signalled_to_commit_soon;
+
     /* For debugging */
 #ifndef NDEBUG
     pthread_t running_pthread;
diff --git a/c7/stm/sync.c b/c7/stm/sync.c
--- a/c7/stm/sync.c
+++ b/c7/stm/sync.c
@@ -269,9 +269,11 @@
     assert(_has_mutex());
     /* never overwrite abort signals or safepoint requests
        (too messy to deal with) */
-    if (!is_abort(other_pseg->pub.nursery_end)
-        && !pause_signalled)
+    if (!other_pseg->signalled_to_commit_soon
+        && !is_abort(other_pseg->pub.nursery_end)
+        && !pause_signalled) {
         other_pseg->pub.nursery_end = NSE_SIGCOMMITSOON;
+    }
 }
 
 static void signal_everybody_to_pause_running(void)
@@ -342,6 +344,7 @@
                 previous_state = 
change_timing_state(STM_TIME_SYNC_COMMIT_SOON);
             }
 
+            STM_PSEGMENT->signalled_to_commit_soon = true;
             stmcb_commit_soon();
             if (!pause_signalled) {
                 STM_SEGMENT->nursery_end = NURSERY_END;
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to