Re: [PATCH v2] skbuff: Improve the sending efficiency of __skb_send_sock
From: David Laight
Date: Sun Jun 29 2025 - 07:33:56 EST
On Fri, 27 Jun 2025 03:19:27 -0700
Eric Dumazet <edumazet@xxxxxxxxxx> wrote:
> On Fri, Jun 27, 2025 at 2:44 AM Feng Yang <yangfeng59949@xxxxxxx> wrote:
> >
> > From: Feng Yang <yangfeng@xxxxxxxxxx>
> >
> > By aggregating skb data into a bvec array for transmission, when using sockmap to forward large packets,
> > what previously required multiple transmissions now only needs a single transmission, which significantly enhances performance.
> > For small packets, the performance remains comparable to the original level.
> >
> > When using sockmap for forwarding, the average latency for different packet sizes
> > after sending 10,000 packets is as follows:
> > size old(us) new(us)
> > 512 56 55
> > 1472 58 58
> > 1600 106 79
> > 3000 145 108
> > 5000 182 123
> >
> > Signed-off-by: Feng Yang <yangfeng@xxxxxxxxxx>
>
> Instead of changing everything, have you tried strategically adding
> MSG_MORE in this function ?
>
Does (could) this code ever be used for protocols other than TCP?
For UDP setting MSG_MORE will generate a single datagram.
For SCTP all the data actually has to be sent as a single sendmsg()
in order to generate a single DATA chunk.
Prior to 6.5 the code used sock->ops->sendpage_locked() so had to do
a separate call per page.
But if all the overheads of 'ioc_iter' are being added it does seen
appropriate to make use of its features!
David