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.
ck_pring
Samy Al Bahra 10 years ago
parent 03440bb7a9
commit 9efb74da4b

@ -28,6 +28,7 @@
#define CK_HP_H #define CK_HP_H
#include <ck_cc.h> #include <ck_cc.h>
#include <ck_md.h>
#include <ck_pr.h> #include <ck_pr.h>
#include <ck_stack.h> #include <ck_stack.h>
@ -81,6 +82,20 @@ ck_hp_set(struct ck_hp_record *record, unsigned int i, void *pointer)
return; 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_CC_INLINE static void
ck_hp_clear(struct ck_hp_record *record) ck_hp_clear(struct ck_hp_record *record)
{ {

Loading…
Cancel
Save