1.. SPDX-License-Identifier: BSD-3-Clause 2 Copyright(c) 2020 Intel Corporation. 3 4Stack Mempool Driver 5==================== 6 7**rte_mempool_stack** is a pure software mempool driver based on the 8``rte_stack`` DPDK library. For run-to-completion workloads with sufficiently 9large per-lcore caches, the mbufs will likely stay in the per-lcore caches and 10the mempool type (ring, stack, etc.) will have a negligible impact on 11performance. However a stack-based mempool is often better suited to pipelined 12packet-processing workloads (which allocate and free mbufs on different lcores) 13than a ring-based mempool, since its LIFO behavior results in better temporal 14locality and a minimal memory footprint even if the mempool is 15over-provisioned. Users are encouraged to benchmark with multiple mempool types 16to determine which works best for their specific application. 17 18The following modes of operation are available for the stack mempool driver and 19can be selected as described in :ref:`Mempool_Handlers`: 20 21- ``stack`` 22 23 The underlying **rte_stack** operates in standard (lock-based) mode. 24 For more information please refer to :ref:`Stack_Library_Std_Stack`. 25 26- ``lf_stack`` 27 28 The underlying **rte_stack** operates in lock-free mode. For more 29 information please refer to :ref:`Stack_Library_LF_Stack`. 30 31The standard stack outperforms the lock-free stack on average, however the 32standard stack is non-preemptive: if a mempool user is preempted while holding 33the stack lock, that thread will block all other mempool accesses until it 34returns and releases the lock. As a result, an application using the standard 35stack whose threads can be preempted can suffer from brief, infrequent 36performance hiccups. 37 38The lock-free stack, by design, is not susceptible to this problem; one thread can 39be preempted at any point during a push or pop operation and will not impede 40the progress of any other thread. 41 42For a more detailed description of the stack implementations, please refer to 43:doc:`../prog_guide/stack_lib`. 44