On 11/30/21 15:18, Pavel Begunkov wrote: > Early proof of concept for zerocopy send via io_uring. This is just > an RFC, there are details yet to be figured out, but hope to gather > some feedback. For larger audience, registered buffers is an io_uring feature where it pins in advance the userspace memory and keeps it as an array of pages (bvec in particular). There is extra logic to make sure the pages stay referenced when there are inflight requests using it, so they can avoid grabbing extra page references. Also, as was asked, attaching a standalone .c version of the benchmark. Requires any relatively up-to-date liburing installed. gcc -luring -O2 -o send-zc ./send-zc.c There are also a couple of options added: ./send-zc [options] [-r ] [-f] udp -r is @nr_reqs from the cover-letter, 8 by default, -f sets @flush to true, false by default. > Benchmarking udp (65435 bytes) with a dummy net device (mtu=0xffff): > The best case io_uring=116079 MB/s vs msg_zerocopy=47421 MB/s, > or 2.44 times faster. > > № | test: | BW (MB/s) | speedup > 1 | msg_zerocopy (non-zc) | 18281 | 0.38 > 2 | msg_zerocopy -z (baseline) | 47421 | 1 > 3 | io_uring (@flush=false, nr_reqs=1) | 96534 | 2.03 > 4 | io_uring (@flush=true, nr_reqs=1) | 89310 | 1.88 > 5 | io_uring (@flush=false, nr_reqs=8) | 116079 | 2.44 > 6 | io_uring (@flush=true, nr_reqs=8) | 109722 | 2.31 > > Based on selftests/.../msg_zerocopy but more limited. You can use > msg_zerocopy -r as usual for receive side. > [...] -- Pavel Begunkov