[pypy-commit] stmgc c8-tcp-style-trx-length: Improve backoff duration computation

tobweber pypy.commits at gmail.com
Fri Jun 30 08:50:57 EDT 2017


Author: Tobias Weber <tobias_weber89 at gmx.de>
Branch: c8-tcp-style-trx-length
Changeset: r2079:50a4a53200e3
Date: 2017-06-27 15:01 +0200
http://bitbucket.org/pypy/stmgc/changeset/50a4a53200e3/

Log:	Improve backoff duration computation

diff --git a/c8/stm/nursery.c b/c8/stm/nursery.c
--- a/c8/stm/nursery.c
+++ b/c8/stm/nursery.c
@@ -34,8 +34,8 @@
         } else {
             new = STM_MIN_RELATIVE_TRANSACTION_LENGTH;
         }
-        // the shorter the trx, the more backoff
-        tl->transaction_length_backoff = (int)(1 / new);
+        // the shorter the trx, the more backoff: 1000 at min trx length, proportional decrease to 1 at max trx length (think a/x + b = backoff)
+        tl->transaction_length_backoff = (int)(0.0000001 / new - 0.9999999);
         tl->linear_transaction_length_increment = new;
     } else if (tl->transaction_length_backoff == 0) {
         // backoff counter is zero, exponential increase up to 1


More information about the pypy-commit mailing list