Author: Tobias Weber <[email protected]>
Branch: c8-tcp-style-trx-length
Changeset: r2121:de7da0f0b0ad
Date: 2017-07-16 00:30 +0200
http://bitbucket.org/pypy/stmgc/changeset/de7da0f0b0ad/
Log: Improve backoff computation
diff --git a/c8/stm/nursery.c b/c8/stm/nursery.c
--- a/c8/stm/nursery.c
+++ b/c8/stm/nursery.c
@@ -23,12 +23,12 @@
// corresponds to ~700 bytes nursery fill
#define STM_MIN_RELATIVE_TRANSACTION_LENGTH (0.00000001)
-#define BACKOFF_MULTIPLIER (0.05 / STM_MIN_RELATIVE_TRANSACTION_LENGTH)
+#define BACKOFF_MULTIPLIER (20 / -log10(STM_MIN_RELATIVE_TRANSACTION_LENGTH))
static inline void set_backoff(stm_thread_local_t *tl, double rel_trx_len) {
// the shorter the trx, the more backoff: 100 at min trx length,
proportional decrease to 5 at max trx length (think a/x + b = backoff)
tl->transaction_length_backoff =
- (int)(1 / (BACKOFF_MULTIPLIER * rel_trx_len) + 5);
+ (int)((BACKOFF_MULTIPLIER * -log10(rel_trx_len)) + 5);
// printf("thread %d, backoff %d\n", tl->thread_local_counter,
tl->transaction_length_backoff);
tl->linear_transaction_length_increment = rel_trx_len;
}
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit