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