ck_brlock: Serialize on atomic operation on read acquisition.

10% improvement for reader acquisition latency on TSO architectures
implementing wait-free FAS.
ck_pring
Samy Al Bahra 12 years ago
parent cb1c72d36b
commit 2bdc231288

@ -187,10 +187,10 @@ ck_brlock_read_lock(struct ck_brlock *br, struct ck_brlock_reader *reader)
while (ck_pr_load_uint(&br->writer) == true) while (ck_pr_load_uint(&br->writer) == true)
ck_pr_stall(); ck_pr_stall();
ck_pr_store_uint(&reader->n_readers, 1); ck_pr_fas_uint(&reader->n_readers, 1);
/* Loads are re-ordered with respect to prior stores. */ /* Serialize counter update with respect to writer snapshot. */
ck_pr_fence_strict_memory(); ck_pr_fence_memory();
if (ck_pr_load_uint(&br->writer) == false) if (ck_pr_load_uint(&br->writer) == false)
break; break;

Loading…
Cancel
Save