Message ID | 169272709850.1975370.16698220879817216294.stgit@firesoul (mailing list archive) |
---|---|
Headers | show |
Series | veth: reduce reallocations of SKBs when XDP bpf-prog is loaded | expand |
On Wed, Aug 23, 2023 at 1:59 AM Jesper Dangaard Brouer <hawk@kernel.org> wrote: > > Loading an XDP bpf-prog on veth device driver results in a significant > performance degradation (for normal unrelated traffic) due to > veth_convert_skb_to_xdp_buff() in most cases fully reallocates an SKB and copy > data over, even when XDP prog does nothing (e.g. XDP_PASS). > > This patchset reduce the cases that cause reallocation. > After patchset UDP and AF_XDP sending avoids reallocations. > This approach is a lot more elegant than registering two XDP memory models and fiddling with the skb and XDP buffer. The tests conducted in our environment show similar figures in terms of performance improvements. For example, using pktgen (skb data buffer allocated by kmalloc) with the following setup: pktgen -> veth1 -> veth0 (XDP_TX) -> veth1 (XDP_PASS) gives an improvement of around 23%. Thanks! Thanks, Liang > Future work will investigate TCP. > > --- > > Jesper Dangaard Brouer (4): > veth: use same bpf_xdp_adjust_head check as generic-XDP > veth: use generic-XDP functions when dealing with SKBs > veth: lift skb_head_is_locked restriction for SKB based XDP > veth: when XDP is loaded increase needed_headroom > > > drivers/net/veth.c | 86 +++++++++++++++++++--------------------------- > net/core/dev.c | 1 + > net/core/filter.c | 1 + > 3 files changed, 38 insertions(+), 50 deletions(-) > > -- > Jesper >