Skip to content

xsk: XSKMAP performance improvements

Björn Töpel bpf netdev 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest3 patches 1 replyIn review
  2. v43 patches 2 repliesSuperseded
  3. v32 patches 4 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v22 patches5 repliesSuperseded

Patches in v5 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3xsk: store struct xdp_sock as a flexible array member of the XSKMAPkernel/bpf/xskmap.c+23 -320 replies
2/3bpf: implement map_gen_lookup() callback for XSKMAPkernel/bpf/xskmap.c+17 -00 replies
3/3xsk: restructure/inline XSKMAP lookup/redirect/flushinclude/linux/bpf.h include/net/xdp_sock.h kernel/bpf/xskmap.c +1 more+70 -870 replies

Reviews trailers per patch

2 of 3 patches have a Reviewed-by or Acked-by.

PatchJonathan Lemon
1/3A-b
2/3A-b
3/3

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v5 thread

Cover letter [PATCH bpf-next v5 0/3] xsk: XSKMAP performance improvements

This set consists of three patches from Maciej and myself which are optimizing the XSKMAP lookups. In the first patch, the sockets are moved to be stored at the tail of the struct xsk_map. The second patch, Maciej implements map_gen_lookup() for XSKMAP. The third patch, introduced in this revision, moves various XSKMAP functions, to permit the compiler to do more aggressive inlining.

Based on the XDP program from tools/lib/bpf/xsk.c where bpf_map_lookup_elem() is explicitly called, this work yields a 5% improvement for xdpsock's rxdrop scenario. The last patch yields 2% improvement.

Jonathan's Acked-by: for patch 1 and 2 was carried on. Note that the overflow checks are done in the bpf_map_area_alloc() and bpf_map_charge_init() functions, which was fixed in commit ff1c08e1f74b ("bpf: Change size to u64 for bpf_map_{area_alloc, charge_init}()").

Cheers,
Björn and Maciej

[1] https://patchwork.ozlabs.org/patch/1186170/

v1->v2: * Change size/cost to size_t and use {struct, array}_size
where appropriate. (Jakub)
v2->v3: * Proper commit message for patch 2.
v3->v4: * Change size_t to u64 to handle 32-bit overflows. (Jakub)
* Introduced patch 3.
v4->v5: * Use BPF_SIZEOF size, instead of BPF_DW, for correct
pointer-sized loads. (Daniel)

Björn Töpel (2):
xsk: store struct xdp_sock as a flexible array member of the XSKMAP
xsk: restructure/inline XSKMAP lookup/redirect/flush

Maciej Fijalkowski (1):
bpf: implement map_gen_lookup() callback for XSKMAP

 include/linux/bpf.h    |  25 ---------
 include/net/xdp_sock.h |  51 ++++++++++++++-----
 kernel/bpf/xskmap.c    | 112 +++++++++++++----------------------------
 net/xdp/xsk.c          |  33 +++++++++++-
 4 files changed, 106 insertions(+), 115 deletions(-)
Signature · 1 line
2.20.1