From 2bdc23128858d1f04ffebc9b451b04af3b477c63 Mon Sep 17 00:00:00 2001 From: Samy Al Bahra Date: Thu, 27 Sep 2012 13:55:29 -0400 Subject: [PATCH] ck_brlock: Serialize on atomic operation on read acquisition. 10% improvement for reader acquisition latency on TSO architectures implementing wait-free FAS. --- include/ck_brlock.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/ck_brlock.h b/include/ck_brlock.h index 2a21f0d..5722cbd 100644 --- a/include/ck_brlock.h +++ b/include/ck_brlock.h @@ -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) 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. */ - ck_pr_fence_strict_memory(); + /* Serialize counter update with respect to writer snapshot. */ + ck_pr_fence_memory(); if (ck_pr_load_uint(&br->writer) == false) break;