[dpdk-dev] [PATCH 2/2] net/mlx5: fix allocation when no memory on device NUMA node

Olivier Matz olivier.matz at 6wind.com
Thu Jan 18 14:00:43 CET 2018


If there is no memory available on the same numa node than the
device, it is preferable to fallback on another socket instead
of failing.

Fixes: 1e3a39f72d5d ("net/mlx5: allocate verbs object into shared memory")
Cc: stable at dpdk.org

Signed-off-by: Olivier Matz <olivier.matz at 6wind.com>
---
 drivers/net/mlx5/mlx5.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 1c95f3520..312f3d5be 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -143,6 +143,10 @@ mlx5_alloc_verbs_buf(size_t size, void *data)
 	assert(data != NULL);
 	ret = rte_malloc_socket(__func__, size, alignment,
 				priv->dev->device->numa_node);
+	if (ret == NULL)
+		ret = rte_malloc_socket(__func__, size, alignment,
+					SOCKET_ID_ANY);
+
 	DEBUG("Extern alloc size: %lu, align: %lu: %p", size, alignment, ret);
 	return ret;
 }
-- 
2.11.0



More information about the dev mailing list