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 <jason.zhang2@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Lijian Zhang <Lijian.Zhang@arm.com>
diff --git a/src/vppinfra/mheap.c b/src/vppinfra/mheap.c
index 2769838..b5566bd 100644
--- a/src/vppinfra/mheap.c
+++ b/src/vppinfra/mheap.c
@@ -82,8 +82,7 @@
if (--h->recursion_count == 0)
{
h->owner_cpu = ~0;
- CLIB_MEMORY_BARRIER ();
- h->lock = 0;
+ clib_atomic_release (&h->lock);
}
}
}