From 9efb74da4b972c69b54ca91d0c83e5078f3b99b0 Mon Sep 17 00:00:00 2001 From: Samy Al Bahra Date: Thu, 21 May 2015 12:22:37 -0400 Subject: [PATCH] ck_hp: Implement ck_hp_set_fence. On TSO architectures, this relies on atomic ordering guarantees rather than a full barrier. On Pentium M, this results in approximately 30% improvement in latency for stack. --- include/ck_hp.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/include/ck_hp.h b/include/ck_hp.h index d032f72..c7d8cfb 100644 --- a/include/ck_hp.h +++ b/include/ck_hp.h @@ -28,6 +28,7 @@ #define CK_HP_H #include +#include #include #include @@ -81,6 +82,20 @@ ck_hp_set(struct ck_hp_record *record, unsigned int i, void *pointer) return; } +CK_CC_INLINE static void +ck_hp_set_fence(struct ck_hp_record *record, unsigned int i, void *pointer) +{ + +#ifdef CK_MD_TSO + ck_pr_fas_ptr(&record->pointers[i], pointer); +#else + ck_pr_store_ptr(&record->pointers[i], pointer); + ck_pr_fence_memory(); +#endif + + return; +} + CK_CC_INLINE static void ck_hp_clear(struct ck_hp_record *record) {