Go to file
Dmitry Kozlyuk 2edd037c09 mem: add dirty malloc element support
EAL malloc layer assumed all free elements content
is filled with zeros ("clean"), as opposed to uninitialized ("dirty").
This assumption was ensured in two ways:
1. EAL memalloc layer always returned clean memory.
2. Freed memory was cleared before returning into the heap.

Clearing the memory can be as slow as around 14 GiB/s.
To save doing so, memalloc layer is allowed to return dirty memory.
Such segments being marked with RTE_MEMSEG_FLAG_DIRTY.
The allocator tracks elements that contain dirty memory
using the new flag in the element header.
When clean memory is requested via rte_zmalloc*()
and the suitable element is dirty, it is cleared on allocation.
When memory is deallocated, the freed element is joined
with adjacent free elements, and the dirty flag is updated:

a) If the joint element contains dirty parts, it is dirty:

    dirty + freed + dirty = dirty  =>  no need to clean
            freed + dirty = dirty      the freed memory

   Dirty parts may be large (e.g. initial allocation),
   so clearing them could create unpredictable slowdown.

b) If the only dirty part of the joint element
   is the freed memory, the joint element can be made clean:

    clean + freed + clean = clean  =>  freed memory
    clean + freed         = clean      must be cleared
            freed + clean = clean
            freed         = clean

   This logic naturally reproduces the old behavior
   and always applies in modes when EAL memalloc layer
   returns only clean segments.

As a result, memory is either cleared on free, as before,
or it will be cleared on allocation if need be, but never twice.

Signed-off-by: Dmitry Kozlyuk <dkozlyuk@nvidia.com>
Reviewed-by: Anatoly Burakov <anatoly.burakov@intel.com>
2022-02-08 21:32:53 +01:00
.ci ci: test minimum configuration 2021-11-17 12:48:20 +01:00
.github/workflows version: 22.03-rc0 2021-12-02 21:36:19 +01:00
app app/test: add allocator performance benchmark 2022-02-08 21:32:53 +01:00
buildtools build: fix warnings when running external commands 2022-02-02 15:44:12 +01:00
config kni: allow configuring thread granularity 2022-02-02 20:45:18 +01:00
devtools devtools: fix comment detection in forbidden token check 2022-01-27 17:17:41 +01:00
doc mem: add dirty malloc element support 2022-02-08 21:32:53 +01:00
drivers net/dpaa2: remove useless C++ include guard 2022-02-08 17:13:24 +01:00
examples examples/ipsec-secgw: fix default flow rule creation 2022-01-21 10:17:35 +01:00
kernel kni: fix ioctl signature 2022-02-02 20:55:05 +01:00
lib mem: add dirty malloc element support 2022-02-08 21:32:53 +01:00
license lib: remove librte_ prefix from directory names 2021-04-21 14:04:09 +02:00
usertools drivers: remove octeontx2 drivers 2022-01-12 15:36:32 +01:00
.editorconfig devtools: clarify that lines up to 100 characters are ok 2021-11-25 11:51:24 +01:00
.gitattributes improve git diff 2016-11-13 15:25:12 +01:00
.gitignore doc: add eventdev feature matrices 2021-11-26 16:29:25 +01:00
.travis.yml version: 22.03-rc0 2021-12-02 21:36:19 +01:00
ABI_VERSION version: 22.03-rc0 2021-12-02 21:36:19 +01:00
MAINTAINERS app/test: add allocator performance benchmark 2022-02-08 21:32:53 +01:00
Makefile build: create dummy Makefile 2020-09-07 23:51:57 +02:00
meson_options.txt config: add option for atomic mbuf reference counting 2021-10-25 17:53:30 +02:00
meson.build build: remove deprecated Meson functions 2022-02-02 18:46:53 +01:00
README license: introduce SPDX identifiers 2018-01-04 22:41:38 +01:00
VERSION version: 22.03-rc0 2021-12-02 21:36:19 +01:00

DPDK is a set of libraries and drivers for fast packet processing.
It supports many processor architectures and both FreeBSD and Linux.

The DPDK uses the Open Source BSD-3-Clause license for the core libraries
and drivers. The kernel components are GPL-2.0 licensed.

Please check the doc directory for release notes,
API documentation, and sample application information.

For questions and usage discussions, subscribe to: users@dpdk.org
Report bugs and issues to the development mailing list: dev@dpdk.org