ticketlock: introduce fair ticket based locking
authorJoyce Kong <joyce.kong@arm.com>
Mon, 25 Mar 2019 11:11:07 +0000 (19:11 +0800)
committerThomas Monjalon <thomas@monjalon.net>
Thu, 28 Mar 2019 13:58:49 +0000 (14:58 +0100)
commit184104fc6121308240413cc0f9dfb5c204679865
tree93221257a4c25c75770d9e6969ec30b84bddefe0
parent6fef1ae4fc109807d13de4235281960b3b1dfd51
ticketlock: introduce fair ticket based locking

The spinlock implementation is unfair, some threads may take locks
aggressively while leaving the other threads starving for long time.

This patch introduces ticketlock which gives each waiting thread a
ticket and they can take the lock one by one. First come, first serviced.
This avoids starvation for too long time and is more predictable.

Suggested-by: Jerin Jacob <jerinj@marvell.com>
Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Ola Liljedahl <ola.liljedahl@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
MAINTAINERS
doc/api/doxy-api-index.md
lib/librte_eal/common/Makefile
lib/librte_eal/common/include/generic/rte_ticketlock.h [new file with mode: 0644]
lib/librte_eal/common/meson.build