[dpdk-dev] [PATCH v4 3/6] ticketlock: use new API to reduce contention on aarch64
From: Gavin Hu <hidden>
Date: 2019-08-22 06:13:56
Subsystem:
library code, the rest · Maintainers:
Andrew Morton, Linus Torvalds
From: Gavin Hu <hidden>
Date: 2019-08-22 06:13:56
Subsystem:
library code, the rest · Maintainers:
Andrew Morton, Linus Torvalds
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 <redacted> Reviewed-by: Honnappa Nagarahalli <redacted> Tested-by: Phil Yang <redacted> Tested-by: Pavan Nikhilesh <redacted> --- lib/librte_eal/common/include/generic/rte_ticketlock.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/lib/librte_eal/common/include/generic/rte_ticketlock.h b/lib/librte_eal/common/include/generic/rte_ticketlock.h
index d9bec87..232bbe9 100644
--- a/lib/librte_eal/common/include/generic/rte_ticketlock.h
+++ b/lib/librte_eal/common/include/generic/rte_ticketlock.h@@ -66,8 +66,7 @@ static inline void 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_acquire_16(&tl->s.current, me); } /**
--
2.7.4