Skip to content

net: bulk alloc side and more bulk free drivers

Jesper Dangaard Brouer netdev 1 version In review

Get series with b4
b4 am 20160304130054.32651.51776.stgit@firesoul

Versions newest first

  1. v1 Latest7 patches 12 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7mlx5: use napi_consume_skb API to get bulk free operationsdrivers/net/ethernet/mellanox/mlx5/core/en.h drivers/net/ethernet/mellanox/mlx5/core/en_tx.c drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c+4 -40 replies
2/7mlx4: use napi_consume_skb API to get bulk free operationsdrivers/net/ethernet/mellanox/mlx4/en_tx.c+13 -624 replies
3/7net: bulk alloc and reuse of SKBs in NAPI contextnet/core/skbuff.c+45 -262 replies
4/7mlx5: use napi_alloc_skb API to get SKB bulk allocationsdrivers/net/ethernet/mellanox/mlx5/core/en.h drivers/net/ethernet/mellanox/mlx5/core/en_rx.c drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c+7 -60 replies
5/7mlx4: use napi_alloc_skb API to get SKB bulk allocationsdrivers/net/ethernet/mellanox/mlx4/en_rx.c+4 -30 replies
6/7net: introduce napi_alloc_skb_hint() for more use-casesinclude/linux/skbuff.h net/core/skbuff.c+18 -90 replies
7/7mlx5: hint the NAPI alloc skb API about the expected bulk sizedrivers/net/ethernet/mellanox/mlx5/core/en.h drivers/net/ethernet/mellanox/mlx5/core/en_rx.c drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c+9 -60 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [net-next PATCH 0/7] net: bulk alloc side and more bulk free drivers

This patchset use the bulk ALLOC side of the kmem_cache bulk APIs, for SKB allocations. The bulk free side got enabled in merge commit 3134b9f019f2 ("net: mitigating kmem_cache free slowpath").

The first two patches is a followup on the free-side, which enables bulk-free in the drivers mlx4 and mlx5 (dev_kfree_skb -> napi_consume_skb).

Rest of patchset is focused on bulk alloc-side. We start with a conservative bulk alloc of 8 SKB, which all drivers using the napi_alloc_skb() call will benefit from. Then the API is extended to, allow driver hinting on needed SKBs (only some drivers know this size), and mlx5 driver is the first user of hinting.

Small hint for people wanting to tune their systems. Default number of SKB objects per slab-page is 32 objects. This limits the bulking sizes for the SLUB allocator. SLUB can be tuned via kernel cmdline boot option slub_min_objects=128. Increasing this gives a significant performance boost, but at the cost of more memory "waste" inside kmem_cache/slab allocator.

Patchset based on net-next at commit 3ebeac1d0295

---

Jesper Dangaard Brouer (7):
mlx5: use napi_consume_skb API to get bulk free operations
mlx4: use napi_consume_skb API to get bulk free operations
net: bulk alloc and reuse of SKBs in NAPI context
mlx5: use napi_alloc_skb API to get SKB bulk allocations
mlx4: use napi_alloc_skb API to get SKB bulk allocations
net: introduce napi_alloc_skb_hint() for more use-cases
mlx5: hint the NAPI alloc skb API about the expected bulk size

 drivers/net/ethernet/mellanox/mlx4/en_rx.c        |    7 +-
 drivers/net/ethernet/mellanox/mlx4/en_tx.c        |   19 ++++-
 drivers/net/ethernet/mellanox/mlx5/core/en.h      |    5 +
 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c   |   11 ++-
 drivers/net/ethernet/mellanox/mlx5/core/en_tx.c   |    4 +
 drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c |    4 +
 include/linux/skbuff.h                            |   19 ++++-
 net/core/skbuff.c                                 |   75 +++++++++++++--------
 8 files changed, 92 insertions(+), 52 deletions(-)