netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hao Xu <haoxu@linux.alibaba.com>
To: netdev@vger.kernel.org, io-uring@vger.kernel.org
Cc: Jens Axboe <axboe@kernel.dk>,
	Pavel Begunkov <asml.silence@gmail.com>,
	Eric Dumazet <edumazet@google.com>,
	"David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
	David Ahern <dsahern@kernel.org>,
	Joseph Qi <joseph.qi@linux.alibaba.com>
Subject: [RFC 0/3] io_uring zerocopy receive
Date: Mon, 24 Jan 2022 17:43:17 +0800	[thread overview]
Message-ID: <20220124094320.900713-1-haoxu@linux.alibaba.com> (raw)

Integrate the current zerocopy receive solution to io_uring for eazier
use. The current calling process is:
  1) mmap a range of virtual address
  2) poll() to wait for data ready of the sockfd
  3) call getsockopt() to map the address in 1) to physical pages
  4) access the data.

By integrating it to io_uring, 2) and 3) can be merged:
  1) mmap a range of virtual address
  2) prepare a sqe and submit
  3) get a cqe which indicates data is ready and mapped
  4) access the data

which reduce one system call and make users be unaware of 3)

Also provide a test case which basically reuses
tools/testing/selftests/net/tcp_mmap.c:
https://github.com/HowHsu/liburing/tree/zc_receive

server side:
taskset -c 1-2 ./zc_receive -s -4 -z -M $((4096+12))

client side:
taskset -c 3 ./tcp_mmap -H '127.0.0.1' -z -4 -M $((4096+12))

no much difference of the result since no functionality change.


Hao Xu (3):
  net-zerocopy: split zerocopy receive to several parts
  net-zerocopy: remove static for tcp_zerocopy_receive()
  io_uring: zerocopy receive

 fs/io_uring.c                 |  72 ++++++++++++++++++
 include/net/tcp.h             |   8 ++
 include/uapi/linux/io_uring.h |   1 +
 net/ipv4/tcp.c                | 134 ++++++++++++++++++++--------------
 4 files changed, 159 insertions(+), 56 deletions(-)

-- 
2.25.1


             reply	other threads:[~2022-01-24  9:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-24  9:43 Hao Xu [this message]
2022-01-24  9:43 ` [PATCH 1/3] net-zerocopy: split zerocopy receive to several parts Hao Xu
2022-01-24 14:09   ` kernel test robot
2022-01-24  9:43 ` [PATCH 2/3] net-zerocopy: remove static for tcp_zerocopy_receive() Hao Xu
2022-01-24  9:43 ` [PATCH 3/3] io_uring: zerocopy receive Hao Xu
2022-01-24 15:01   ` kernel test robot
2022-01-24 15:42   ` kernel test robot

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=20220124094320.900713-1-haoxu@linux.alibaba.com \
    --to=haoxu@linux.alibaba.com \
    --cc=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=io-uring@vger.kernel.org \
    --cc=joseph.qi@linux.alibaba.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=yoshfuji@linux-ipv6.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).