@@ -41,14 +41,16 @@ extern "C" {
4141
4242// We only use values x and backoffs b such that
4343// x + 1 is near to 2**(2*b+1) and x + 1 is prime.
44- static _Py_BackoffCounter backoff_counter_table [] = {
45- MAKE_BACKOFF_COUNTER (1 , 0 ),
44+ static _Py_BackoffCounter backoff_counter_next_table [] = {
4645 MAKE_BACKOFF_COUNTER (6 , 1 ),
4746 MAKE_BACKOFF_COUNTER (30 , 2 ),
4847 MAKE_BACKOFF_COUNTER (126 , 3 ),
4948 MAKE_BACKOFF_COUNTER (508 , 4 ),
5049 MAKE_BACKOFF_COUNTER (2052 , 5 ),
5150 MAKE_BACKOFF_COUNTER (8190 , 6 ),
51+ // We use the same backoff counter for all backoffs >= MAX_BACKOFF.
52+ MAKE_BACKOFF_COUNTER (8190 , 6 ),
53+ MAKE_BACKOFF_COUNTER (8190 , 6 ),
5254};
5355
5456static inline _Py_BackoffCounter
@@ -64,8 +66,7 @@ restart_backoff_counter(_Py_BackoffCounter counter)
6466{
6567 uint16_t backoff = counter .value_and_backoff & BACKOFF_MASK ;
6668 assert (backoff <= MAX_BACKOFF );
67- backoff = (backoff >= MAX_BACKOFF ) ? MAX_BACKOFF : backoff + 1 ;
68- return backoff_counter_table [backoff ];
69+ return backoff_counter_next_table [backoff ];
6970}
7071
7172static inline _Py_BackoffCounter
0 commit comments