[dpdk-dev,2/2] net/mlx5: fix allocation when no memory on device NUMA node
Checks
Commit Message
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@dpdk.org
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---
drivers/net/mlx5/mlx5.c | 4 ++++
1 file changed, 4 insertions(+)
Comments
On Thu, Jan 18, 2018 at 02:00:43PM +0100, Olivier Matz wrote:
> 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@dpdk.org
>
> Signed-off-by: Olivier Matz <olivier.matz@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
>
This function is the finalisation of the creation of the queues and
contains the buffers to the CQ/WQ which must be on the correct socket
otherwise the performances will be limited.
Even if this function is only called on dev_start() it must reflect the
configuration requested from the application on the
rte_eth_{tx,rx}_queue_setup().
Regards,
@@ -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;
}