numam-dpdk/app
Dmitry Kozlyuk 13b196425c app/testpmd: fix external buffer allocation
External pinned buffer memory (--mp-alloc=xbuf)
was allocated as multiple IOVA-contiguous memzones
of 2M size and 2M alignment.
Due to the malloc overhead and the alignment requirement,
each 2M memzone consumed 4M of hugepage memory:
2M of usable memory + X of malloc overhead + (2M-X) padding.
The allocation often failed with 2M hugepages and IOVA-as-PA
if a PA-contiguous span of 2 hugepages could not be found.
Also, with any hugepage size and IOVA mode
memory consumption was almost 2x of the usable amount.

Alignment requirement of 2M for external buffers is redundant.
It was an attempt to ensure IOVA-contiguity
by forcing memzones to start at hugepage boundaries,
while 2M size intended to leave no unused space on the page.
As shown above, this in fact caused excessive memory consumption
and decreased the chance of a successful allocation.
RTE_MEMZONE_F_IOVA_CONTIG already ensures IOVA-contiguity.

Remove the alignment requirement.
Reduce the memzone size by the malloc overhead size (4 cache lines),
so that memory consumption for each memzone is
(2M-X) of usable memory + X of malloc overhead = 2M.
This also means that whenever there are free 2M hugepages,
an IOVA-contiguous memzone can always be allocated.

Fixes: 72512e1897 ("app/testpmd: add mempool with external data buffers")
Cc: stable@dpdk.org

Signed-off-by: Dmitry Kozlyuk <dkozlyuk@nvidia.com>
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
2022-01-18 14:22:15 +01:00
..
dumpcap build: cleanup libpcap dependent components 2021-11-10 11:42:34 +01:00
pdump devtools: forbid indent with tabs in Meson 2021-11-02 19:25:30 +01:00
proc-info fix spelling in comments and strings 2022-01-11 12:16:53 +01:00
test test/crypto: add copy/set DF cases in IPsec 2022-01-21 11:55:12 +01:00
test-acl fix spelling in comments and strings 2022-01-11 12:16:53 +01:00
test-bbdev app/bbdev: use compiler atomics for shared data sync 2021-11-17 11:07:06 +01:00
test-cmdline devtools: forbid indent with tabs in Meson 2021-11-02 19:25:30 +01:00
test-compress-perf fix spelling in comments and strings 2022-01-11 12:16:53 +01:00
test-crypto-perf fix spelling in comments and strings 2022-01-11 12:16:53 +01:00
test-eventdev fix spelling in comments and strings 2022-01-11 12:16:53 +01:00
test-fib fix spelling in comments and strings 2022-01-11 12:16:53 +01:00
test-flow-perf fix spelling in comments and strings 2022-01-11 12:16:53 +01:00
test-gpudev gpudev: add alignment for memory allocation 2022-01-21 11:33:25 +01:00
test-pipeline app: remove unneeded atomic header include 2021-11-17 11:07:06 +01:00
test-pmd app/testpmd: fix external buffer allocation 2022-01-18 14:22:15 +01:00
test-regex devtools: forbid indent with tabs in Meson 2021-11-02 19:25:30 +01:00
test-sad devtools: forbid indent with tabs in Meson 2021-11-02 19:25:30 +01:00
meson.build build: make pdump optional 2021-11-17 12:49:19 +01:00