ck_spinlock: Apply modulo arithmetic to proportional back-off ticket lock.

ck_pring
Samy Al Bahra 12 years ago
parent d0745f51ee
commit 045d0e1053

@ -492,7 +492,7 @@ ck_spinlock_ticket_lock_pb(struct ck_spinlock_ticket *ticket, unsigned int c)
position = CK_SPINLOCK_TICKET_LOAD(&ticket->value) &
CK_SPINLOCK_TICKET_MASK;
backoff = request - position;
backoff = (request - position) & CK_SPINLOCK_TICKET_MASK;
backoff <<= c;
ck_backoff_eb(&backoff);
}
@ -596,8 +596,7 @@ ck_spinlock_ticket_lock_pb(struct ck_spinlock_ticket *ticket, unsigned int c)
if (position == request)
break;
/* Overflow is handled fine, assuming 2s complement. */
backoff = (request - position);
backoff = (request - position) & CK_SPINLOCK_TICKET_MASK;
backoff <<= c;
/*

Loading…
Cancel
Save