From: Feifei Wang Date: Mon, 1 Nov 2021 06:00:05 +0000 (+0800) Subject: mcslock: use wait until scheme for unlock X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=4ed4e554ac015de0a2661310ea6bb48ea6e1c977;p=dpdk.git 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 --- 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. */