Skip to content

Commit d8c13f2

Browse files
Eric Dumazetdavem330
authored andcommitted
net/mlx4_en: try to use high order pages for RX rings
RX rings can fit most of the time in a contiguous piece of memory, so lets use kvzalloc_node/kvfree instead of vzalloc_node/vfree Note that kvzalloc_node() automatically falls back to another node, there is no need to do the fallback ourselves. Signed-off-by: Eric Dumazet <edumazet@google.com> Reviewed-by: Tariq Toukan <tariqt@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 7d99429 commit d8c13f2

File tree

1 file changed

+5
-8
lines changed
  • drivers/net/ethernet/mellanox/mlx4

1 file changed

+5
-8
lines changed

drivers/net/ethernet/mellanox/mlx4/en_rx.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -291,13 +291,10 @@ int mlx4_en_create_rx_ring(struct mlx4_en_priv *priv,
291291

292292
tmp = size * roundup_pow_of_two(MLX4_EN_MAX_RX_FRAGS *
293293
sizeof(struct mlx4_en_rx_alloc));
294-
ring->rx_info = vzalloc_node(tmp, node);
294+
ring->rx_info = kvzalloc_node(tmp, GFP_KERNEL, node);
295295
if (!ring->rx_info) {
296-
ring->rx_info = vzalloc(tmp);
297-
if (!ring->rx_info) {
298-
err = -ENOMEM;
299-
goto err_xdp_info;
300-
}
296+
err = -ENOMEM;
297+
goto err_xdp_info;
301298
}
302299

303300
en_dbg(DRV, priv, "Allocated rx_info ring at addr:%p size:%d\n",
@@ -318,7 +315,7 @@ int mlx4_en_create_rx_ring(struct mlx4_en_priv *priv,
318315
return 0;
319316

320317
err_info:
321-
vfree(ring->rx_info);
318+
kvfree(ring->rx_info);
322319
ring->rx_info = NULL;
323320
err_xdp_info:
324321
xdp_rxq_info_unreg(&ring->xdp_rxq);
@@ -447,7 +444,7 @@ void mlx4_en_destroy_rx_ring(struct mlx4_en_priv *priv,
447444
bpf_prog_put(old_prog);
448445
xdp_rxq_info_unreg(&ring->xdp_rxq);
449446
mlx4_free_hwq_res(mdev->dev, &ring->wqres, size * stride + TXBB_SIZE);
450-
vfree(ring->rx_info);
447+
kvfree(ring->rx_info);
451448
ring->rx_info = NULL;
452449
kfree(ring);
453450
*pring = NULL;

0 commit comments

Comments
 (0)