eal: fix mem alloc from control thread if socket 0 is unused
authorIlyes Ben Hamouda <ilyes.ben_hamouda@6wind.com>
Fri, 29 Oct 2021 09:06:36 +0000 (11:06 +0200)
committerOlivier Matz <olivier.matz@6wind.com>
Fri, 29 Oct 2021 09:49:13 +0000 (11:49 +0200)
commitd50c3395cc691e7b524c138b8cf26deb2da49437
treef4c679c6c515fe092791cadfa6dd668aade1470b
parentefb57dd5bbf0ffac645d09ed4d0dbad088b602f1
eal: fix mem alloc from control thread if socket 0 is unused

When using rte_malloc() from a control thread, 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>
lib/eal/common/malloc_heap.c
lib/eal/common/malloc_heap.h