Skip to content

dataplane: fix memory cleanup order and improve mempool diagnostics - #330

Open
ezhk wants to merge 2 commits into
mainfrom
fix/memory-cleanup
Open

dataplane: fix memory cleanup order and improve mempool diagnostics#330
ezhk wants to merge 2 commits into
mainfrom
fix/memory-cleanup

Conversation

@ezhk

@ezhk ezhk commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Add memory_manager::cleanup() that explicitly frees all tracked hugepage
allocations before rte_eal_cleanup() is called. Without this, the
implicit destruction of memory_manager (which happens after the destructor
body) called rte_free() on already-torn-down EAL, corrupting glibc's
internal linked lists and crashing with 'corrupted double-linked list'.

Also log mempool allocation parameters (count, element size, approximate
total MB) at INFO level for fp/wgc/cp pools to aid capacity planning, and
call memory_manager::debug() on the relevant socket when mempool creation
fails to surface fragmentation details in the error path.

ezhk added 2 commits July 8, 2026 15:12
The KNI (virtio_user vdev) MAC address is baked into the vdev creation
arguments at init_kernel_interfaces() time, which happens before the
physical port is started. For some drivers the MAC is only valid (or may
change) once rte_eth_dev_start() is called, which resulted in a mismatch:
one MAC in yanet and a different one in the system after the interface
was brought up.

Read the actual MAC via dpdk::GetMacAddress() after the port is started
and apply it to all KNI interfaces (forward/in/out/drop) via
SIOCSIFHWADDR while they are still DOWN, before SetUp() raises IFF_UP.

Also fix a pre-existing socket leak in SetUp() and harden interface name
copying with IFNAMSIZ - 1.
Add memory_manager::cleanup() that explicitly frees all tracked hugepage
allocations before rte_eal_cleanup() is called.  Without this, the
implicit destruction of memory_manager (which happens after the destructor
body) called rte_free() on already-torn-down EAL, corrupting glibc's
internal linked lists and crashing with 'corrupted double-linked list'.

Also log mempool allocation parameters (count, element size, approximate
total MB) at INFO level for fp/wgc/cp pools to aid capacity planning, and
call memory_manager::debug() on the relevant socket when mempool creation
fails to surface fragmentation details in the error path.
@ezhk
ezhk requested a review from GeorgyKirichenko as a code owner July 8, 2026 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant