spinlock/fas: improve codegen for the uncontended path

Mark acquisition failures as unlikely: there's no point in reaching
the spinloop slow path more quickly.

TESTED=existing regression tests.
awsm
Paul Khuong 5 years ago committed by Samy Al Bahra
parent b520d58d00
commit 571bb264b0

@ -77,9 +77,10 @@ CK_CC_INLINE static void
ck_spinlock_fas_lock(struct ck_spinlock_fas *lock)
{
while (ck_pr_fas_uint(&lock->value, true) == true) {
while (ck_pr_load_uint(&lock->value) == true)
while (CK_CC_UNLIKELY(ck_pr_fas_uint(&lock->value, true) == true)) {
do {
ck_pr_stall();
} while (ck_pr_load_uint(&lock->value) == true);
}
ck_pr_fence_lock();

Loading…
Cancel
Save