From: Eric Dumazet <eric.dumazet@gmail.com>
To: Marek Majkowski <marek@cloudflare.com>
Cc: netdev@vger.kernel.org
Subject: Re: splice() performance for TCP socket forwarding
Date: Thu, 13 Dec 2018 06:05:48 -0800 [thread overview]
Message-ID: <cfb3ed6d-ff44-c0ad-4531-9fc3d2a63e8d@gmail.com> (raw)
In-Reply-To: <5c39d023-ac09-bf46-1605-f60ed40705f1@gmail.com>
On 12/13/2018 06:03 AM, Eric Dumazet wrote:
>
>
> On 12/13/2018 05:33 AM, Marek Majkowski wrote:
>> Ok, 4.19 does seem to kinda fix the SO_RCVLOWAT with splice, but I
>> don't fully understand it:
>>
>> fcntl(8, F_SETPIPE_SZ, 1048576) = 1048576 <0.000033>
>> setsockopt(4, SOL_SOCKET, SO_RCVLOWAT, [131072], 4) = 0 <0.000014>
>> splice(4, NULL, 9, NULL, 1048576, SPLICE_F_MOVE) = 121435 <71.039385>
>> splice(8, NULL, 5, NULL, 121435, SPLICE_F_MOVE) = 121435 <0.000118>
>> splice(4, NULL, 9, NULL, 1048576, SPLICE_F_MOVE) = 11806 <0.000019>
>> splice(8, NULL, 5, NULL, 11806, SPLICE_F_MOVE) = 11806 <0.000018>
>>
>
> Good point.
>
> At this moment SO_RCVLOWAT only tries to reduce number of POLLIN events.
>
> But if your splice() system call is performed while there are already
> available skbs in the receive queue, splice() wont block and deliver
> what is available in the queue.
>
> I guess that we would need to add some logic in recvmsg() and tcp_splice_read()
> to truly implement SO_RCVLOWAT : block until at least sk->sk_rcvlowat bytes are
> available in receive queue.
>
You could also work around the problem by inserting a poll() system call before the splice(),
since poll() would only deliver the POLLIN event when sk->sk_rcvlowat bytes are present in the queue.
next prev parent reply other threads:[~2018-12-13 14:05 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-13 11:25 splice() performance for TCP socket forwarding Marek Majkowski
2018-12-13 12:49 ` Eric Dumazet
2018-12-13 13:17 ` Marek Majkowski
2018-12-13 13:18 ` Marek Majkowski
2018-12-13 13:33 ` Marek Majkowski
2018-12-13 14:03 ` Eric Dumazet
2018-12-13 14:05 ` Eric Dumazet [this message]
2018-12-13 14:04 ` Willy Tarreau
2018-12-13 12:55 ` Willy Tarreau
2018-12-13 13:37 ` Eric Dumazet
2018-12-13 13:57 ` Willy Tarreau
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cfb3ed6d-ff44-c0ad-4531-9fc3d2a63e8d@gmail.com \
--to=eric.dumazet@gmail.com \
--cc=marek@cloudflare.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).