]> git.droids-corp.org - dpdk.git/commit
malloc: fix allocation with unknown socket ID
authorIlyes Ben Hamouda <ilyes.ben_hamouda@6wind.com>
Fri, 29 Oct 2021 09:49:29 +0000 (11:49 +0200)
committerDavid Marchand <david.marchand@redhat.com>
Fri, 5 Nov 2021 14:28:49 +0000 (15:28 +0100)
commit770d41bf33090462319c765c86a4c1979dc2a148
tree3eac0fa72cbe99d4f2e8353f11c5144a36d73dd5
parentbb0bd346d5c130350be3fe019cd48ecbbe50ab90
malloc: fix allocation with unknown socket ID

When using rte_malloc() from a thread which is not bound to a numa
socket (the typical case is a control thread, but it can also happen
on a dataplane thread if its cpu affinity is on cores attached to
several sockets), the used heap is the one from numa socket 0, which
may not have available memory.

Fix this by selecting the first socket which has available memory.

Note: malloc_get_numa_socket() is only used from one .c file, so move
it there, and remove the inline keyword.

Fixes: b94580d6887e ("malloc: avoid unknown socket id")
Cc: stable@dpdk.org
Signed-off-by: Ilyes Ben Hamouda <ilyes.ben_hamouda@6wind.com>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: David Marchand <david.marchand@redhat.com>
lib/eal/common/malloc_heap.c
lib/eal/common/malloc_heap.h