From 4ed4e554ac015de0a2661310ea6bb48ea6e1c977 Mon Sep 17 00:00:00 2001 From: Feifei Wang Date: Mon, 1 Nov 2021 14:00:05 +0800 Subject: [PATCH] mcslock: use wait until scheme for unlock Instead of polling for mcslock to be updated, use wait until scheme for this case. Signed-off-by: Feifei Wang Reviewed-by: Ruifeng Wang Acked-by: Jerin Jacob --- lib/eal/include/generic/rte_mcslock.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/eal/include/generic/rte_mcslock.h b/lib/eal/include/generic/rte_mcslock.h index 34f33c64a5..f15b785358 100644 --- a/lib/eal/include/generic/rte_mcslock.h +++ b/lib/eal/include/generic/rte_mcslock.h @@ -116,8 +116,10 @@ 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(); + uintptr_t *next; + next = (uintptr_t *)&me->next; + RTE_WAIT_UNTIL_MASKED(next, UINTPTR_MAX, !=, 0, + __ATOMIC_RELAXED); } /* Pass lock to next waiter. */ -- 2.39.5