diff options
author | jaszha03 <jason.zhang2@arm.com> | 2019-06-12 16:01:19 -0500 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2019-07-30 11:46:19 +0000 |
commit | 0455c435af501889de51c79a223883b3c2003b20 (patch) | |
tree | c869cd21043469888ee2a23e563e958ce05e3a96 /src/vppinfra | |
parent | d56550c2b669558aa38d93f44a9a3b31e0b9370f (diff) |
vppinfra: conformed spinlocks to use CLIB_PAUSE
Modified test-and-set spin locks to call CLIB_PAUSE () when spinning
for code consistency. Decreases the memory bandwidth consumed.
Type: fix
Change-Id: I1cca4f87f44f23f257c7a35466cd2e7767072f51
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>
Diffstat (limited to 'src/vppinfra')
-rw-r--r-- | src/vppinfra/elog.c | 3 | ||||
-rw-r--r-- | src/vppinfra/mheap.c | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/vppinfra/elog.c b/src/vppinfra/elog.c index 12ac3a596e4..489ccf436d9 100644 --- a/src/vppinfra/elog.c +++ b/src/vppinfra/elog.c @@ -41,13 +41,14 @@ #include <vppinfra/format.h> #include <vppinfra/hash.h> #include <vppinfra/math.h> +#include <vppinfra/lock.h> static inline void elog_lock (elog_main_t * em) { if (PREDICT_FALSE (em->lock != 0)) while (clib_atomic_test_and_set (em->lock)) - ; + CLIB_PAUSE (); } static inline void diff --git a/src/vppinfra/mheap.c b/src/vppinfra/mheap.c index ba5bbc9b6e7..2769838d4ba 100644 --- a/src/vppinfra/mheap.c +++ b/src/vppinfra/mheap.c @@ -41,6 +41,7 @@ #include <vppinfra/mheap.h> #include <vppinfra/os.h> #include <vppinfra/time.h> +#include <vppinfra/lock.h> #ifdef CLIB_UNIX #include <vppinfra/elf_clib.h> @@ -64,7 +65,7 @@ mheap_maybe_lock (void *v) } while (clib_atomic_test_and_set (&h->lock)) - ; + CLIB_PAUSE (); h->owner_cpu = my_cpu; h->recursion_count = 1; |