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.14 in commit 40b95b92f1db 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.14 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 fails to compile. Please refer to patch 1/2 for more details.
A new version of this patch is proposed here fixing the compilation issue. It has been validated: it fixes the original issue on v4.14 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 [3]. 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: 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/161806389310822@kroah.com/ [3] https://lore.kernel.org/stable/16187490172453@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(-)