numam-dpdk/lib
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
..
acl fix spelling in comments and strings 2022-01-11 12:16:53 +01:00
bbdev fix PMD wording 2021-11-26 11:28:34 +01:00
bitratestats bitrate: promote free function to stable 2021-10-01 15:31:47 +02:00
bpf fix spelling in comments and strings 2022-01-11 12:16:53 +01:00
cfgfile version: 21.11-rc0 2021-08-17 08:37:52 +02:00
cmdline cmdline: free on exit 2021-10-22 23:32:00 +02:00
compressdev fix PMD wording 2021-11-26 11:28:34 +01:00
cryptodev fix PMD wording 2021-11-26 11:28:34 +01:00
distributor distributor: use wait until scheme 2021-11-03 15:50:14 +01:00
dmadev fix spelling in comments and strings 2022-01-11 12:16:53 +01:00
eal mem: add dirty malloc element support 2022-02-08 21:32:53 +01:00
efd build/windows: remove separate list of libs 2021-10-22 22:40:59 +02:00
ethdev ethdev: fix Rx queue telemetry memory leak on failure 2022-01-25 10:58:32 +01:00
eventdev eventdev: remove useless C++ include guard 2022-02-08 17:15:47 +01:00
fib fix spelling in comments and strings 2022-01-11 12:16:53 +01:00
flow_classify build/windows: remove separate list of libs 2021-10-22 22:40:59 +02:00
gpudev gpudev: add alignment for memory allocation 2022-01-21 11:33:25 +01:00
graph build/windows: remove separate list of libs 2021-10-22 22:40:59 +02:00
gro net: rename Ethernet header fields 2021-10-08 14:58:11 +02:00
gso mbuf: add namespace to offload flags 2021-10-24 13:37:43 +02:00
hash hash: clarify comment for bucket entries number 2021-11-17 18:33:33 +01:00
ip_frag remove repeated 'the' in the code 2021-11-26 11:28:34 +01:00
ipsec fix spelling in comments and strings 2022-01-11 12:16:53 +01:00
jobstats build/windows: remove separate list of libs 2021-10-22 22:40:59 +02:00
kni kni: check error code of allmulticast mode switch 2021-11-08 11:56:13 +01:00
kvargs kvargs: fix comments style 2021-09-30 17:38:13 +02:00
latencystats version: 21.11-rc0 2021-08-17 08:37:52 +02:00
lpm lpm6: fix buffer overflow 2021-10-25 19:08:16 +02:00
mbuf fix spelling in comments and strings 2022-01-11 12:16:53 +01:00
member build/windows: remove separate list of libs 2021-10-22 22:40:59 +02:00
mempool mempool: fix non-IO flag inference 2021-10-25 16:52:56 +02:00
meter version: 21.11-rc0 2021-08-17 08:37:52 +02:00
metrics build: factorize jansson availability check 2021-11-10 16:23:05 +01:00
net fix spelling in comments and strings 2022-01-11 12:16:53 +01:00
node fix spelling in comments and doxygen 2021-11-16 17:57:09 +01:00
pcapng pcapng: use new ethdev namespace 2021-10-31 23:25:02 +01:00
pci eal: remove sys/queue.h from public headers 2021-10-01 13:09:43 +02:00
pdump pdump: fix freeing statistics memzone 2021-11-03 12:53:03 +01:00
pipeline fix spelling in comments and strings 2022-01-11 12:16:53 +01:00
port ip_frag: add namespace 2021-11-17 10:29:14 +01:00
power fix spelling in comments and strings 2022-01-11 12:16:53 +01:00
rawdev remove repeated 'the' in the code 2021-11-26 11:28:34 +01:00
rcu fix spelling in comments and doxygen 2021-11-16 17:57:09 +01:00
regexdev fix spelling in comments and strings 2022-01-11 12:16:53 +01:00
reorder build/windows: remove separate list of libs 2021-10-22 22:40:59 +02:00
rib fix spelling in comments and doxygen 2021-11-16 17:57:09 +01:00
ring ring: fix overflow in memory size calculation 2022-02-05 18:15:33 +01:00
sched fix spelling in comments and strings 2022-01-11 12:16:53 +01:00
security security: add telemetry endpoint for capabilities 2021-11-04 19:46:27 +01:00
stack stack: remove unneeded atomic header include 2021-10-19 17:15:10 +02:00
table fix spelling in comments and strings 2022-01-11 12:16:53 +01:00
telemetry fix spelling in comments and strings 2022-01-11 12:16:53 +01:00
timer version: 21.11-rc0 2021-08-17 08:37:52 +02:00
vhost vhost: use proper logging type for data path 2022-01-27 09:46:02 +01:00
meson.build build: make cfgfile optional 2022-01-21 06:09:00 -05:00