Author: Tobias Weber <[email protected]>
Branch: c8-tcp-style-trx-length
Changeset: r2139:6a3c6e601284
Date: 2017-07-24 11:10 +0200
http://bitbucket.org/pypy/stmgc/changeset/6a3c6e601284/
Log: Set backoff to best working value so far and re-enable slow start
diff --git a/c8/stm/nursery.c b/c8/stm/nursery.c
--- a/c8/stm/nursery.c
+++ b/c8/stm/nursery.c
@@ -23,7 +23,7 @@
// corresponds to ~4 KB nursery fill
#define STM_MIN_RELATIVE_TRANSACTION_LENGTH (0.000001)
-#define BACKOFF_COUNT (5)
+#define BACKOFF_COUNT (20)
#define BACKOFF_MULTIPLIER (BACKOFF_COUNT /
-log10(STM_MIN_RELATIVE_TRANSACTION_LENGTH))
static inline void set_backoff(stm_thread_local_t *tl, double rel_trx_len) {
@@ -32,10 +32,10 @@
backoff is <BACKOFF_COUNT> + b at default trx length,
linear decrease to b at max trx length */
const int b = 5;
- tl->transaction_length_backoff =
- (int)((BACKOFF_MULTIPLIER * -log10(rel_trx_len)) + b);
+ int new_backoff = (int)((BACKOFF_MULTIPLIER * -log10(rel_trx_len)) + b);
+ tl->transaction_length_backoff = new_backoff;
// printf("thread %d, backoff %d\n", tl->thread_local_counter,
tl->transaction_length_backoff);
- tl->linear_transaction_length_increment = rel_trx_len / (BACKOFF_COUNT +
b);
+ tl->linear_transaction_length_increment = rel_trx_len / new_backoff;
}
static inline double get_new_transaction_length(stm_thread_local_t *tl, bool
aborts) {
@@ -55,10 +55,10 @@
if (new > 1) {
new = 1;
}
- // if (tl->linear_transaction_length_increment != 0) {
- // // thread had to abort before: slow start
- // set_backoff(tl, new);
- // }
+ if (tl->linear_transaction_length_increment != 0) {
+ // thread had to abort before: slow start
+ set_backoff(tl, new);
+ }
} else { // not abort and backoff != 0
// in backoff, linear increase up to 1
new = previous + tl->linear_transaction_length_increment;
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit