While using ticket lock, cores repeatedly poll the lock variable.
This is replaced by rte_wait_until_equal API.
Running ticketlock_autotest on ThunderX2, Ampere eMAG80, and Arm N1SDP[1],
there were variances between runs, but no notable performance gain or
degradation were seen with and without this patch.
[1] https://community.arm.com/developer/tools-software/oss-platforms/w/\
docs/440/neoverse-n1-sdp
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Tested-by: Phil Yang <phil.yang@arm.com>
Tested-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Reviewed-by: Jerin Jacob <jerinj@marvell.com>
rte_ticketlock_lock(rte_ticketlock_t *tl)
{
uint16_t me = __atomic_fetch_add(&tl->s.next, 1, __ATOMIC_RELAXED);
- while (__atomic_load_n(&tl->s.current, __ATOMIC_ACQUIRE) != me)
- rte_pause();
+ rte_wait_until_equal_16(&tl->s.current, me, __ATOMIC_ACQUIRE);
}
/**