[dpdk-dev] [PATCH v1 2/2] mcslock: use wait until equal API for tight loop
Feifei Wang
feifei.wang2 at arm.com
Wed Aug 25 10:01:27 CEST 2021
Instead of polling for previous lock holder unlocking, use
wait_until_equal API.
Signed-off-by: Feifei Wang <feifei.wang2 at arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang at arm.com>
---
lib/eal/include/generic/rte_mcslock.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/eal/include/generic/rte_mcslock.h b/lib/eal/include/generic/rte_mcslock.h
index 9f323bd2a2..c99343f22c 100644
--- a/lib/eal/include/generic/rte_mcslock.h
+++ b/lib/eal/include/generic/rte_mcslock.h
@@ -84,8 +84,8 @@ rte_mcslock_lock(rte_mcslock_t **msl, rte_mcslock_t *me)
* to spin on me->locked until the previous lock holder resets
* the me->locked using mcslock_unlock().
*/
- while (__atomic_load_n(&me->locked, __ATOMIC_ACQUIRE))
- rte_pause();
+ rte_wait_until_equal_32((volatile uint32_t *)&me->locked,
+ 0, __ATOMIC_ACQUIRE);
}
/**
--
2.25.1
More information about the dev
mailing list