From: Pavel Begunkov <[email protected]>
To: Jakub Kicinski <[email protected]>, David Wei <[email protected]>
Cc: [email protected], [email protected],
Jens Axboe <[email protected]>, Paolo Abeni <[email protected]>,
"David S. Miller" <[email protected]>,
Eric Dumazet <[email protected]>,
Jesper Dangaard Brouer <[email protected]>,
David Ahern <[email protected]>,
Mina Almasry <[email protected]>,
Stanislav Fomichev <[email protected]>,
Joe Damato <[email protected]>,
Pedro Tammela <[email protected]>
Subject: Re: [PATCH net-next v8 11/17] io_uring/zcrx: implement zerocopy receive pp memory provider
Date: Tue, 10 Dec 2024 04:50:40 +0000 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
On 12/10/24 04:45, Pavel Begunkov wrote:
> On 12/10/24 04:01, Jakub Kicinski wrote:
>> On Wed, 4 Dec 2024 09:21:50 -0800 David Wei wrote:
>>> Then, either the buffer is dropped and returns back to the page pool
>>> into the ->freelist via io_pp_zc_release_netmem, in which case the page
>>> pool will match hold_cnt for us with ->pages_state_release_cnt. Or more
>>> likely the buffer will go through the network/protocol stacks and end up
>>> in the corresponding socket's receive queue. From there the user can get
>>> it via an new io_uring request implemented in following patches. As
>>> mentioned above, before giving a buffer to the user we bump the refcount
>>> by IO_ZC_RX_UREF.
>>>
>>> Once the user is done with the buffer processing, it must return it back
>>> via the refill queue, from where our ->alloc_netmems implementation can
>>> grab it, check references, put IO_ZC_RX_UREF, and recycle the buffer if
>>> there are no more users left. As we place such buffers right back into
>>> the page pools fast cache and they didn't go through the normal pp
>>> release path, they are still considered "allocated" and no pp hold_cnt
>>> is required. For the same reason we dma sync buffers for the device
>>> in io_zc_add_pp_cache().
>>
>> Can you say more about the IO_ZC_RX_UREF bias? net_iov is not the page
>> struct, we can add more fields. In fact we have 8B of padding in it
>> that can be allocated without growing the struct. So why play with
>
> I guess we can, though it's growing it for everyone not just
> io_uring considering how indexing works, i.e. no embedding into
> a larger struct.
>
>> biases? You can add a 32b atomic counter for how many refs have been
>> handed out to the user.
>
> This set does it in a stupid way, but the bias allows to coalesce
> operations with it into a single atomic. Regardless, it can be
> placed separately, though we still need a good way to optimise
> counting. Take a look at my reply with questions in the v7 thread,
> I outlined what can work quite well in terms of performance but
> needs a clear api for that from net/
FWIW, I tried it and placed user refs into a separate array.
Without optimisations it'll be additional atomics + cache
bouncing, which is not great, but if we can somehow reuse the
frag ref as in replies to v7, that might work even better than
with the bias. Devmem might reuse that as well.
--
Pavel Begunkov
next prev parent reply other threads:[~2024-12-10 4:49 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-04 17:21 [PATCH net-next v8 00/17] io_uring zero copy rx David Wei
2024-12-04 17:21 ` [PATCH net-next v8 01/17] net: prefix devmem specific helpers David Wei
2024-12-04 21:00 ` Mina Almasry
2024-12-04 21:24 ` David Wei
2024-12-04 17:21 ` [PATCH net-next v8 02/17] net: generalise net_iov chunk owners David Wei
2024-12-09 17:01 ` Mina Almasry
2024-12-04 17:21 ` [PATCH net-next v8 03/17] net: page_pool: create hooks for custom page providers David Wei
2024-12-10 3:02 ` Jakub Kicinski
2024-12-10 16:31 ` David Wei
2024-12-04 17:21 ` [PATCH net-next v8 04/17] net: prepare for non devmem TCP memory providers David Wei
2024-12-09 17:04 ` Mina Almasry
2024-12-10 3:15 ` Jakub Kicinski
2024-12-10 3:53 ` Pavel Begunkov
2024-12-10 4:06 ` Jakub Kicinski
2024-12-10 4:15 ` Pavel Begunkov
2024-12-04 17:21 ` [PATCH net-next v8 05/17] net: page_pool: add ->scrub mem provider callback David Wei
2024-12-09 17:08 ` Mina Almasry
2024-12-09 17:24 ` Pavel Begunkov
2024-12-04 17:21 ` [PATCH net-next v8 06/17] net: page pool: add helper creating area from pages David Wei
2024-12-10 3:29 ` Jakub Kicinski
2024-12-10 3:58 ` Pavel Begunkov
2024-12-04 17:21 ` [PATCH net-next v8 07/17] net: page_pool: introduce page_pool_mp_return_in_cache David Wei
2024-12-09 17:15 ` Mina Almasry
2024-12-09 17:28 ` Pavel Begunkov
2024-12-10 3:40 ` Jakub Kicinski
2024-12-10 4:31 ` Pavel Begunkov
2024-12-11 0:06 ` Jakub Kicinski
2024-12-04 17:21 ` [PATCH net-next v8 08/17] net: add helper executing custom callback from napi David Wei
2024-12-10 3:44 ` Jakub Kicinski
2024-12-10 4:11 ` Pavel Begunkov
2024-12-04 17:21 ` [PATCH net-next v8 09/17] io_uring/zcrx: add interface queue and refill queue David Wei
2024-12-06 16:05 ` Simon Horman
2024-12-09 23:50 ` David Wei
2024-12-10 3:49 ` Jakub Kicinski
2024-12-10 4:03 ` Pavel Begunkov
2024-12-10 4:07 ` Jakub Kicinski
2024-12-04 17:21 ` [PATCH net-next v8 10/17] io_uring/zcrx: add io_zcrx_area David Wei
2024-12-04 17:21 ` [PATCH net-next v8 11/17] io_uring/zcrx: implement zerocopy receive pp memory provider David Wei
2024-12-10 4:01 ` Jakub Kicinski
2024-12-10 4:45 ` Pavel Begunkov
2024-12-10 4:50 ` Pavel Begunkov [this message]
2024-12-11 0:24 ` Jakub Kicinski
2024-12-11 14:42 ` Pavel Begunkov
2024-12-12 1:38 ` Jakub Kicinski
2024-12-12 13:42 ` Pavel Begunkov
2024-12-10 16:55 ` Mina Almasry
2024-12-04 17:21 ` [PATCH net-next v8 12/17] io_uring/zcrx: add io_recvzc request David Wei
2024-12-04 17:21 ` [PATCH net-next v8 13/17] io_uring/zcrx: set pp memory provider for an rx queue David Wei
2024-12-04 17:21 ` [PATCH net-next v8 14/17] io_uring/zcrx: add copy fallback David Wei
2024-12-04 17:21 ` [PATCH net-next v8 15/17] io_uring/zcrx: throttle receive requests David Wei
2024-12-04 17:21 ` [PATCH net-next v8 16/17] net: add documentation for io_uring zcrx David Wei
2024-12-09 17:51 ` Mina Almasry
2024-12-10 16:53 ` David Wei
2024-12-09 17:52 ` Mina Almasry
2024-12-10 16:54 ` David Wei
2024-12-04 17:21 ` [PATCH net-next v8 17/17] io_uring/zcrx: add selftest David Wei
2024-12-04 18:59 ` [PATCH net-next v8 00/17] io_uring zero copy rx Pavel Begunkov
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 \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
/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