summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2021-06-02 11:17:29 -0700
committerDave Wallace <dwallacelf@gmail.com>2021-06-03 19:11:27 +0000
commit76189089b519639bd1a06378efcfe523e1a73e8e (patch)
tree9f7f6c215a808a9e2484d5745203f6a4e0ca49fc
parent5b6d2c1ae26addadc8ab44eaadcf88ebf95a4fd0 (diff)
svm: release mem order for fifo chunk list CAS
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Signed-off-by: Dave Wallace <dwallacelf@gmail.com> Change-Id: Ifad679f46abd6e9c18a3eaf7e55800a09f3791ab (cherry picked from commit 324d161963025a595a79a10cf953b23250f825a1)
-rw-r--r--src/svm/fifo_segment.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/svm/fifo_segment.c b/src/svm/fifo_segment.c
index cb1f08a7e9f..b680d27fe33 100644
--- a/src/svm/fifo_segment.c
+++ b/src/svm/fifo_segment.c
@@ -161,8 +161,9 @@ fss_chunk_free_list_push (fifo_segment_header_t *fsh,
c->next = old_head & FS_CL_HEAD_MASK;
new_head = csp + ((old_head + FS_CL_HEAD_TINC) & FS_CL_HEAD_TMASK);
}
- while (!clib_atomic_cmp_and_swap_acq_relax (
- &fss->free_chunks[fl_index], &old_head, &new_head, 1 /* weak */));
+ while (!__atomic_compare_exchange (&fss->free_chunks[fl_index], &old_head,
+ &new_head, 0 /* weak */, __ATOMIC_RELEASE,
+ __ATOMIC_ACQUIRE));
}
static void
@@ -181,8 +182,9 @@ fss_chunk_free_list_push_list (fifo_segment_header_t *fsh,
tail->next = old_head & FS_CL_HEAD_MASK;
new_head = headsp + ((old_head + FS_CL_HEAD_TINC) & FS_CL_HEAD_TMASK);
}
- while (!clib_atomic_cmp_and_swap_acq_relax (
- &fss->free_chunks[fl_index], &old_head, &new_head, 1 /* weak */));
+ while (!__atomic_compare_exchange (&fss->free_chunks[fl_index], &old_head,
+ &new_head, 0 /* weak */, __ATOMIC_RELEASE,
+ __ATOMIC_ACQUIRE));
}
static svm_fifo_chunk_t *
@@ -210,8 +212,9 @@ fss_chunk_free_list_pop (fifo_segment_header_t *fsh, fifo_segment_slice_t *fss,
c = fs_chunk_ptr (fsh, old_head & FS_CL_HEAD_MASK);
new_head = c->next + ((old_head + FS_CL_HEAD_TINC) & FS_CL_HEAD_TMASK);
}
- while (!clib_atomic_cmp_and_swap_acq_relax (
- &fss->free_chunks[fl_index], &old_head, &new_head, 1 /* weak */));
+ while (!__atomic_compare_exchange (&fss->free_chunks[fl_index], &old_head,
+ &new_head, 0 /* weak */, __ATOMIC_RELEASE,
+ __ATOMIC_ACQUIRE));
return c;
}