numam-dpdk/lib
Gage Eads 3340202f59 stack: add lock-free implementation
This commit adds support for a lock-free (linked list based) stack to the
stack API. This behavior is selected through a new rte_stack_create() flag,
RTE_STACK_F_LF.

The stack consists of a linked list of elements, each containing a data
pointer and a next pointer, and an atomic stack depth counter.

The lock-free push operation enqueues a linked list of pointers by pointing
the tail of the list to the current stack head, and using a CAS to swing
the stack head pointer to the head of the list. The operation retries if it
is unsuccessful (i.e. the list changed between reading the head and
modifying it), else it adjusts the stack length and returns.

The lock-free pop operation first reserves num elements by adjusting the
stack length, to ensure the dequeue operation will succeed without
blocking. It then dequeues pointers by walking the list -- starting from
the head -- then swinging the head pointer (using a CAS as well). While
walking the list, the data pointers are recorded in an object table.

This algorithm stack uses a 128-bit compare-and-swap instruction, which
atomically updates the stack top pointer and a modification counter, to
protect against the ABA problem.

The linked list elements themselves are maintained in a lock-free LIFO
list, and are allocated before stack pushes and freed after stack pops.
Since the stack has a fixed maximum depth, these elements do not need to be
dynamically created.

Signed-off-by: Gage Eads <gage.eads@intel.com>
Reviewed-by: Olivier Matz <olivier.matz@6wind.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
2019-04-04 22:06:16 +02:00
..
librte_acl acl: fix compiler flags with meson and AVX2 runtime 2019-03-27 10:38:06 +01:00
librte_bbdev
librte_bitratestats
librte_bpf build: improve dependency handling 2019-02-27 12:13:54 +01:00
librte_cfgfile
librte_cmdline compat: merge compat library into EAL 2019-02-25 16:03:31 +01:00
librte_compressdev compressdev: add flag to specify where processing is done 2019-03-22 15:54:24 +01:00
librte_cryptodev cryptodev: add RSA private key feature flag 2019-04-02 16:50:24 +02:00
librte_distributor
librte_eal eal/x86: fix pedantic build 2019-04-04 17:22:06 +02:00
librte_efd efd: fix tail queue leak 2019-01-19 00:07:52 +01:00
librte_ethdev ethdev: add min/max MTU to device info 2019-03-29 18:57:42 +01:00
librte_eventdev eventdev: check timer adapter status before start 2019-04-02 03:10:40 +02:00
librte_flow_classify
librte_gro gro: check invalid TCP header length 2019-01-17 22:38:54 +01:00
librte_gso gso: fix VxLAN/GRE tunnel checks 2019-01-22 17:08:21 +01:00
librte_hash hash: support lock-free extendable bucket 2019-04-03 20:52:35 +02:00
librte_ip_frag
librte_ipsec ipsec: de-duplicate crypto op prepare 2019-04-02 16:50:24 +02:00
librte_jobstats
librte_kni eal: remove exec-env directory 2019-04-02 21:49:35 +02:00
librte_kvargs build: add module definition files for Windows 2019-04-03 01:21:31 +02:00
librte_latencystats
librte_lpm lpm: remove recursively included header file 2019-01-28 01:47:23 +01:00
librte_mbuf mbuf: add function to generate raw Tx offload value 2019-04-02 16:50:24 +02:00
librte_member
librte_mempool use appropriate EAL macro for constructors 2019-03-27 23:10:57 +01:00
librte_meter meter: fix divide by zero for RFC4115 2019-03-29 20:51:25 +01:00
librte_metrics
librte_net mbuf: remove Intel offload checks from generic API 2019-04-02 16:42:52 +02:00
librte_pci
librte_pdump
librte_pipeline net: add PPPoE ethertypes 2019-03-29 20:55:25 +01:00
librte_port
librte_power power: add bit for high frequency cores 2019-04-02 02:22:08 +02:00
librte_rawdev
librte_reorder
librte_ring ring: fix an error message 2019-04-03 18:39:16 +02:00
librte_sched
librte_security security: add opaque userdata pointer into security session 2019-01-10 16:57:22 +01:00
librte_stack stack: add lock-free implementation 2019-04-04 22:06:16 +02:00
librte_table
librte_telemetry telemetry: fix mapping of statistics 2019-04-02 02:30:53 +02:00
librte_timer
librte_vhost vhost/crypto: fix parens 2019-03-29 17:25:32 +01:00
Makefile stack: introduce stack library 2019-04-04 22:06:16 +02:00
meson.build stack: introduce stack library 2019-04-04 22:06:16 +02:00