ck_epoch: Emit fence instructions for TSO, do not emit for recursive calls.

Unfortunately, there are still workloads which will not
serialize. Recursive calls into ck_epoch_begin have no
need for fence instructions.
ck_pring
Samy Al Bahra 13 years ago
parent 3d3f1c9045
commit c45098b21b

@ -93,11 +93,20 @@ ck_epoch_begin(ck_epoch_t *epoch, ck_epoch_record_t *record)
*/ */
if (record->active == 0) { if (record->active == 0) {
unsigned int g_epoch = ck_pr_load_uint(&epoch->epoch); unsigned int g_epoch = ck_pr_load_uint(&epoch->epoch);
/*
* It is possible for loads to be re-ordered before the store
* is committed into the caller's epoch and active fields.
* Execute a full barrier to serialize stores with respect to
* loads
*/
ck_pr_store_uint(&record->epoch, g_epoch); ck_pr_store_uint(&record->epoch, g_epoch);
ck_pr_store_uint(&record->active, 1);
ck_pr_fence_strict_memory();
return;
} }
ck_pr_store_uint(&record->active, record->active + 1); ck_pr_store_uint(&record->active, record->active + 1);
ck_pr_fence_memory();
return; return;
} }

@ -294,7 +294,7 @@ ck_epoch_barrier(struct ck_epoch *global, struct ck_epoch_record *record)
* Guarantee any mutations previous to the barrier will be made visible * Guarantee any mutations previous to the barrier will be made visible
* with respect to epoch snapshots we will read. * with respect to epoch snapshots we will read.
*/ */
ck_pr_fence_memory(); ck_pr_fence_strict_memory();
for (i = 0, cr = NULL; i < CK_EPOCH_GRACE - 1; cr = NULL, i++) { for (i = 0, cr = NULL; i < CK_EPOCH_GRACE - 1; cr = NULL, i++) {
/* /*

Loading…
Cancel
Save