]> git.droids-corp.org - dpdk.git/commitdiff
mcslock: use wait until scheme for unlock
authorFeifei Wang <feifei.wang2@arm.com>
Mon, 1 Nov 2021 06:00:05 +0000 (14:00 +0800)
committerDavid Marchand <david.marchand@redhat.com>
Wed, 3 Nov 2021 14:50:14 +0000 (15:50 +0100)
Instead of polling for mcslock to be updated, use wait until scheme
for this case.

Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
lib/eal/include/generic/rte_mcslock.h

index 34f33c64a556111794a450f3c6e37eeeb81ba38e..f15b785358f252aa438701d8003014280975698f 100644 (file)
@@ -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. */