From: Eric Dumazet <eric.dumazet@gmail.com>
To: Jonathan Corbet <corbet@lwn.net>, Eric Dumazet <eric.dumazet@gmail.com>
Cc: Eric Dumazet <edumazet@google.com>,
"David S . Miller" <davem@davemloft.net>,
netdev <netdev@vger.kernel.org>,
Neal Cardwell <ncardwell@google.com>,
Yuchung Cheng <ycheng@google.com>,
Soheil Hassas Yeganeh <soheil@google.com>
Subject: Re: [PATCH net-next 4/5] tcp: implement mmap() for zero copy receive
Date: Fri, 20 Apr 2018 08:39:53 -0700 [thread overview]
Message-ID: <633a84fd-ef6a-91a1-e45a-86d44ab2b9ac@gmail.com> (raw)
In-Reply-To: <20180420091951.713c0b95@lwn.net>
On 04/20/2018 08:19 AM, Jonathan Corbet wrote:
> On Thu, 19 Apr 2018 18:01:32 -0700
> Eric Dumazet <eric.dumazet@gmail.com> wrote:
>
>> We can keep mmap() nice interface, granted we can add one hook like in following patch.
>>
>> David, do you think such patch would be acceptable by lkml and mm/fs maintainers ?
>>
>> Alternative would be implementing an ioctl() or getsockopt() operation,
>> but it seems less natural...
>
Hi Jonathan
> So I have little standing here, but what the heck, not letting that bother
> me has earned me a living for the last 20 years or so...:)
>
> I think you should consider switching over to an interface where you
> mmap() the region once, and use ioctl() to move the data into that region,
> for a couple of reasons beyond the locking issues you've already found:
>
> - The "mmap() consumes data" semantics are a bit ... strange, IMO.
> That's not what mmap() normally does. People expect ioctl() to do
> magic things, instead.
Well, the thing is that most of our use cases wont reuse same mmap() area.
RPC layer will provide all RPC with their associated pages to RPC consumers.
RPC consumers will decide to keep these pages or consume them.
So having to mmap() + another syscall to consume XXX bytes from receive queue is not
going to save cpu cycles :/
Having the ability to call mmap() multiple times for the same TCP payload is not
going to be of any use in real applications. This is why I only support 'offset 0'
for the last mmap() parameter.
>
> - I would expect it to be a tiny bit faster, since you wouldn't be doing
> the VMA setup and teardown each time.
Maybe for the degenerated case we can reuse the same region over and over.
next prev parent reply other threads:[~2018-04-20 15:39 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-16 17:33 [PATCH net-next 0/5] tcp: add zero copy receive Eric Dumazet
2018-04-16 17:33 ` [PATCH net-next 1/5] tcp: fix SO_RCVLOWAT and RCVBUF autotuning Eric Dumazet
2018-04-20 2:02 ` Marcelo Ricardo Leitner
2018-04-20 2:36 ` Eric Dumazet
2018-04-20 3:04 ` Marcelo Ricardo Leitner
2018-04-16 17:33 ` [PATCH net-next 2/5] tcp: fix delayed acks behavior for SO_RCVLOWAT Eric Dumazet
2018-04-16 17:33 ` [PATCH net-next 3/5] tcp: avoid extra wakeups for SO_RCVLOWAT users Eric Dumazet
2018-04-16 17:33 ` [PATCH net-next 4/5] tcp: implement mmap() for zero copy receive Eric Dumazet
2018-04-19 23:15 ` Eric Dumazet
2018-04-20 1:01 ` Eric Dumazet
2018-04-20 1:17 ` David Miller
2018-04-20 15:19 ` Jonathan Corbet
2018-04-20 15:39 ` Eric Dumazet [this message]
2018-04-16 17:33 ` [PATCH net-next 5/5] selftests: net: add tcp_mmap program Eric Dumazet
2018-04-16 22:48 ` [PATCH net-next 0/5] tcp: add zero copy receive David Miller
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=633a84fd-ef6a-91a1-e45a-86d44ab2b9ac@gmail.com \
--to=eric.dumazet@gmail.com \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=ncardwell@google.com \
--cc=netdev@vger.kernel.org \
--cc=soheil@google.com \
--cc=ycheng@google.com \
/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).