pflock: add phase-fair reader writer locks
authorStephen Hemminger <stephen@networkplumber.org>
Fri, 2 Apr 2021 01:42:47 +0000 (18:42 -0700)
committerDavid Marchand <david.marchand@redhat.com>
Wed, 14 Apr 2021 19:59:47 +0000 (21:59 +0200)
commit9667d97c250729eba96f95daa16c248d9bef27f3
treefa721564d94b15ffb3b6229c9a7e712c1f548c1b
parentdda66e716c0550ee8b218428a6d2129bd9c97740
pflock: add phase-fair reader writer locks

This is a new type of reader-writer lock that provides better fairness
guarantees which better suited for typical DPDK applications.
A pflock has two ticket pools, one for readers and one
for writers.

Phase-fair reader writer locks ensure that neither reader nor writer will
be starved.
Neither reader or writer are preferred, they execute in alternating
phases.
All operations of the same type (reader or writer) that acquire the lock
are handled in FIFO order.
Write operations are exclusive, and multiple read operations can be run
together (until a write arrives).

A similar implementation is in Concurrency Kit package in FreeBSD.
For more information see:
   "Reader-Writer Synchronization for Shared-Memory Multiprocessor
    Real-Time Systems",
    http://www.cs.unc.edu/~anderson/papers/ecrts09b.pdf

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
12 files changed:
MAINTAINERS
app/test/meson.build
app/test/test_pflock.c [new file with mode: 0644]
doc/api/doxy-api-index.md
doc/guides/rel_notes/release_21_05.rst
lib/librte_eal/arm/include/meson.build
lib/librte_eal/arm/include/rte_pflock.h [new file with mode: 0644]
lib/librte_eal/include/generic/rte_pflock.h [new file with mode: 0644]
lib/librte_eal/ppc/include/meson.build
lib/librte_eal/ppc/include/rte_pflock.h [new file with mode: 0644]
lib/librte_eal/x86/include/meson.build
lib/librte_eal/x86/include/rte_pflock.h [new file with mode: 0644]