[PATCH] malloc: enhance NUMA affinity heuristic

David Marchand david.marchand at redhat.com
Wed Dec 21 11:48:57 CET 2022


Trying to allocate memory on the first detected numa node has less
chance to find some memory actually available rather than on the main
lcore numa node (especially when the DPDK application is started only
on one numa node).

Signed-off-by: David Marchand <david.marchand at redhat.com>
---
 lib/eal/common/malloc_heap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/eal/common/malloc_heap.c b/lib/eal/common/malloc_heap.c
index d7c410b786..08f965a525 100644
--- a/lib/eal/common/malloc_heap.c
+++ b/lib/eal/common/malloc_heap.c
@@ -717,7 +717,7 @@ malloc_get_numa_socket(void)
 			return socket_id;
 	}
 
-	return rte_socket_id_by_idx(0);
+	return rte_lcore_to_socket_id(rte_get_main_lcore());
 }
 
 void *
-- 
2.38.1



More information about the dev mailing list