Instead of polling for mcslock to be updated, use wait event scheme
for this case.

Signed-off-by: Feifei Wang <feifei.wa...@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.w...@arm.com>
---
 lib/eal/include/generic/rte_mcslock.h | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/lib/eal/include/generic/rte_mcslock.h 
b/lib/eal/include/generic/rte_mcslock.h
index 34f33c64a5..08137c361b 100644
--- a/lib/eal/include/generic/rte_mcslock.h
+++ b/lib/eal/include/generic/rte_mcslock.h
@@ -116,8 +116,13 @@ rte_mcslock_unlock(rte_mcslock_t **msl, rte_mcslock_t *me)
                /* More nodes added to the queue by other CPUs.
                 * Wait until the next pointer is set.
                 */
-               while (__atomic_load_n(&me->next, __ATOMIC_RELAXED) == NULL)
-                       rte_pause();
+#ifdef RTE_ARCH_32
+               rte_wait_event((uint32_t *)&me->next, UINT32_MAX, 0, ==,
+                               __ATOMIC_RELAXED, 32);
+#else
+               rte_wait_event((uint64_t *)&me->next, UINT64_MAX, 0, ==,
+                               __ATOMIC_RELAXED, 64);
+#endif
        }
 
        /* Pass lock to next waiter. */
-- 
2.25.1

Reply via email to