eal: fix crash when allocating memory on a control thread tmp_20211026
authorIlyes Ben Hamouda <ilyes.ben_hamouda@6wind.com>
Tue, 17 Aug 2021 12:49:09 +0000 (14:49 +0200)
committerOlivier Matz <olivier.matz@6wind.com>
Tue, 26 Oct 2021 09:35:57 +0000 (11:35 +0200)
commitb7cdfefe409609bf37484934699a10a14bb9f9a3
treefd64d6f48daba1490b59452c008a372b5d1fc477
parent3a05b98dd6d72851d4a8819dbffcd52aaf98a2b1
eal: fix crash when allocating memory on a control thread

By using rte_malloc(), the choice of a numa socket
in case of SOCKET_ID_ANY is 0. This may lead to control
thread crash in alloc_seg() when numa node 0 is not used.

Let's choose the first numa socket where memory is available.

Note:
malloc_get_numa_socket is no longer small(contains a loop).
Hence, inline keyword was removed.

PR=74909
Fixes: b94580d6887e ("malloc: avoid unknown socket id")
Signed-off-by: Ilyes Ben Hamouda <ilyes.ben_hamouda@6wind.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
lib/eal/common/malloc_heap.c
lib/eal/common/malloc_heap.h