From f25e7cfa5c615e1972d5823b65ca579f951d68a5 Mon Sep 17 00:00:00 2001 From: jaszha03 Date: Wed, 12 Jun 2019 16:01:19 -0500 Subject: vppinfra: refactor use of CLIB_MEMORY_BARRIER () All instances of test_and_set locks used the following sequence to release the locks: CLIB_MEMORY_BARRIER (); p->lock = 0; // p is a generic struct with a TAS lock Use clib_atomic_release to generate more efficient assembly code. Type: refactor Change-Id: Idca3a38b1cf43578108bdd1afe83b6ebc17a4c68 Signed-off-by: Jason Zhang Reviewed-by: Honnappa Nagarahalli Reviewed-by: Lijian Zhang --- src/svm/ssvm.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/svm') diff --git a/src/svm/ssvm.h b/src/svm/ssvm.h index 6c679456bff..60e0cc61ca4 100644 --- a/src/svm/ssvm.h +++ b/src/svm/ssvm.h @@ -128,8 +128,7 @@ ssvm_unlock (ssvm_shared_header_t * h) { h->owner_pid = 0; h->tag = 0; - CLIB_MEMORY_BARRIER (); - h->lock = 0; + clib_atomic_release (&h->lock); } } @@ -137,8 +136,7 @@ always_inline void ssvm_unlock_non_recursive (ssvm_shared_header_t * h) { h->tag = 0; - CLIB_MEMORY_BARRIER (); - h->lock = 0; + clib_atomic_release (&h->lock); } static inline void * -- cgit 1.2.3-korg