Commit 3226b158e67c ("net: avoid 32 x truesize under-estimation for tiny skbs") introduces a ~10% performance drop when using virtio-net drivers.
This commit has been backported to v4.19 in commit 669c0b5782fb and this performance drop is also visible there. Here at Tessares, we can also notice this drop with the MPTCP fork [1] on top of the v4.19 kernel.
Eric Dumazet already fixed this issue a few months ago, see commit 0f6925b3e8da ("virtio_net: Do not pull payload in skb->head").
Unfortunately, this patch has not been backported to < v5.4 because it caused issues [2]. Indeed, after having backported it, the kernel failed to compile because one commit was missing, see commit 503d539a6e41 ("virtio_net: Add XDP meta data support"). However, this missing commit has been added in 4.19.186 but probably because there were still some opened discussions [3] around commit 0f6925b3e8da ("virtio_net: Do not pull payload in skb->head"), the latter has not been backported at all in v4.19.
A cherry-pick of this patch without any modification is proposed here. It has been validated: it fixes the original issue on v4.19 as well.
Please note that there is also a fix for the fix, see commit 38ec4944b593 ("gro: ensure frag0 meets IP header alignment").
This second fix has also not been backported because it caused issues as well [4]. Here, it was due to a conflict but also a compilation error when the conflict has been resolved. Please refer to patch 2/2 for more details.
One last note: these two patches have also been backported and validated on a v4.14 release. A second series is going to be sent. It looks like it could be interesting to backport these two patches to v4.9 and v4.4 as well but unfortunately, the backport of these two patches fails with conflicts and I don't have any setup to validate the performance drop and fix with v4.9 and v4.4 kernels.
[1] https://github.com/multipath-tcp/mptcp [2] https://lore.kernel.org/stable/161806389686151@kroah.com/ [3] https://lore.kernel.org/stable/20210412051204-mutt-send-email-mst@kernel.org... [4] https://lore.kernel.org/stable/1618749018155126@kroah.com/
Eric Dumazet (2): virtio_net: Do not pull payload in skb->head gro: ensure frag0 meets IP header alignment
drivers/net/virtio_net.c | 10 +++++++--- include/linux/skbuff.h | 9 +++++++++ include/linux/virtio_net.h | 14 +++++++++----- net/core/dev.c | 3 ++- 4 files changed, 27 insertions(+), 9 deletions(-)