diff --git a/include/ck_backoff.h b/include/ck_backoff.h index c71233b..f86414c 100644 --- a/include/ck_backoff.h +++ b/include/ck_backoff.h @@ -38,7 +38,7 @@ typedef volatile unsigned int ck_backoff_t; /* - * This is an exponential back-off implementation. + * This is a exponential back-off implementation. */ CK_CC_INLINE static void ck_backoff_eb(volatile unsigned int *c) @@ -50,27 +50,6 @@ ck_backoff_eb(volatile unsigned int *c) for (i = 0; i < ceiling; i++); - ceiling *= ceiling; - ceiling &= CK_BACKOFF_CEILING; - ceiling += CK_BACKOFF_INITIALIZER; - - *c = ceiling; - return; -} - -/* - * This is a geometric back-off implementation. - */ -CK_CC_INLINE static void -ck_backoff_gb(volatile unsigned int *c) -{ - volatile unsigned int i; - unsigned int ceiling; - - ceiling = *c; - - for (i = 0; i < ceiling; i++); - *c = ceiling <<= ceiling < CK_BACKOFF_CEILING; return; } diff --git a/regressions/ck_backoff/validate/validate.c b/regressions/ck_backoff/validate/validate.c index 5d20e28..bcf41a5 100644 --- a/regressions/ck_backoff/validate/validate.c +++ b/regressions/ck_backoff/validate/validate.c @@ -41,8 +41,9 @@ main(void) for (;;) { ck_backoff_t previous = backoff; - ck_backoff_gb(&backoff); + ck_backoff_eb(&backoff); + printf("EB %u\n", backoff); if (previous == ceiling) { if (backoff != ceiling) ck_error("[C] GB: expected %u, got %u\n", ceiling, backoff); @@ -54,19 +55,6 @@ main(void) } } - backoff = CK_BACKOFF_INITIALIZER; - for (;;) { - ck_backoff_t previous = backoff; - ck_backoff_eb(&backoff); - - if (backoff = previous) { - if (i++ >= 3) - break; - } else if (previous * previous >= backoff) { - ck_error("[N] EB: expected %u (%u), got %u\n", previous * previous, previous, backoff); - } - } - return 0; } diff --git a/src/ck_hp.c b/src/ck_hp.c index 845068f..f118de1 100644 --- a/src/ck_hp.c +++ b/src/ck_hp.c @@ -316,7 +316,7 @@ ck_hp_purge(struct ck_hp_record *thread) while (thread->n_pending > 0) { ck_hp_reclaim(thread); if (thread->n_pending > 0) - ck_backoff_gb(&backoff); + ck_backoff_eb(&backoff); } return;