From: Bobby Eshleman <bobbyeshleman@gmail.com>
To: Mina Almasry <almasrymina@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
Kuniyuki Iwashima <kuniyu@google.com>,
Willem de Bruijn <willemb@google.com>,
Neal Cardwell <ncardwell@google.com>,
David Ahern <dsahern@kernel.org>, Arnd Bergmann <arnd@arndb.de>,
Jonathan Corbet <corbet@lwn.net>,
Andrew Lunn <andrew+netdev@lunn.ch>,
Shuah Khan <shuah@kernel.org>,
Donald Hunter <donald.hunter@gmail.com>,
Stanislav Fomichev <sdf@fomichev.me>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arch@vger.kernel.org, linux-doc@vger.kernel.org,
linux-kselftest@vger.kernel.org, asml.silence@gmail.com,
matttbe@kernel.org, skhawaja@google.com,
Bobby Eshleman <bobbyeshleman@meta.com>
Subject: Re: [PATCH net-next v10 0/5] net: devmem: improve cpu cost of RX token management
Date: Mon, 26 Jan 2026 10:45:22 -0800 [thread overview]
Message-ID: <aXe2QhzL4DoVbesQ@devvm11784.nha0.facebook.com> (raw)
In-Reply-To: <CAHS8izMZxM6rcF+7Lfw=KFv4dmbHGSUrQBPmxO+sYj=V3TRuwQ@mail.gmail.com>
On Wed, Jan 21, 2026 at 08:21:36PM -0800, Mina Almasry wrote:
> On Tue, Jan 20, 2026 at 5:07 PM Jakub Kicinski <kuba@kernel.org> wrote:
> >
> > On Thu, 15 Jan 2026 21:02:11 -0800 Bobby Eshleman wrote:
> > > This series improves the CPU cost of RX token management by adding an
> > > attribute to NETDEV_CMD_BIND_RX that configures sockets using the
> > > binding to avoid the xarray allocator and instead use a per-binding niov
> > > array and a uref field in niov.
> > >
> > > Improvement is ~13% cpu util per RX user thread.
> > >
> > > Using kperf, the following results were observed:
> > >
> > > Before:
> > > Average RX worker idle %: 13.13, flows 4, test runs 11
> > > After:
> > > Average RX worker idle %: 26.32, flows 4, test runs 11
> > >
> > > Two other approaches were tested, but with no improvement. Namely, 1)
> > > using a hashmap for tokens and 2) keeping an xarray of atomic counters
> > > but using RCU so that the hotpath could be mostly lockless. Neither of
> > > these approaches proved better than the simple array in terms of CPU.
> > >
> > > The attribute NETDEV_A_DMABUF_AUTORELEASE is added to toggle the
> > > optimization. It is an optional attribute and defaults to 0 (i.e.,
> > > optimization on).
> >
> > IDK if the cmsg approach is still right for this flow TBH.
> > IIRC when Stan talked about this a while back we were considering doing
> > this via Netlink. Anything that proves that the user owns the binding
> > would work. IIUC the TCP socket in this design just proves that socket
> > has received a token from a given binding right?
>
> Doesn't 'doing this via netlink' imply it's a control path operation
> that acquires rtnl_lock or netdev_lock or some heavy lock expecting
> you to do some config change? Returning tokens is a data-path
> operation, IIRC we don't even lock the socket to do it in the
> setsockopt.
>
> Is there precedent/path to doing fast data-path operations via netlink?
> There may be value in not biting more than we can chew in one series.
> Maybe an alternative non-setsockopt dontneeding scheme should be its
> own patch series.
>
I'm onboard with improving what we have since it helps all of us
currently using this API, though I'm not opposed to discussing a
redesign in another thread/RFC. I do see the attraction to locating the
core logic in one place and possibly reducing some complexity around
socket/binding relationships.
FWIW regarding nl, I do see it supports rtnl lock-free operations via
'62256f98f244 rtnetlink: add RTNL_FLAG_DOIT_UNLOCKED' and routing was
recently made lockless with that. I don't see / know of any fast path
precedent. I'm aware there are some things I'm not sure about being
relevant performance-wise, like hitting skb alloc an additional time
every release batch. I'd want to do some minimal latency comparisons
between that path and sockopt before diving head-first.
Best,
Bobby
next prev parent reply other threads:[~2026-01-26 18:45 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-16 5:02 [PATCH net-next v10 0/5] net: devmem: improve cpu cost of RX token management Bobby Eshleman
2026-01-16 5:02 ` [PATCH net-next v10 1/5] net: devmem: rename tx_vec to vec in dmabuf binding Bobby Eshleman
2026-01-16 5:02 ` [PATCH net-next v10 2/5] net: devmem: refactor sock_devmem_dontneed for autorelease split Bobby Eshleman
2026-01-16 5:02 ` [PATCH net-next v10 3/5] net: devmem: implement autorelease token management Bobby Eshleman
2026-01-21 1:00 ` Jakub Kicinski
2026-01-21 5:33 ` Bobby Eshleman
2026-01-22 4:15 ` Mina Almasry
2026-01-22 5:18 ` Bobby Eshleman
2026-01-16 5:02 ` [PATCH net-next v10 4/5] net: devmem: document NETDEV_A_DMABUF_AUTORELEASE netlink attribute Bobby Eshleman
2026-01-21 0:36 ` Jakub Kicinski
2026-01-21 5:44 ` Bobby Eshleman
2026-01-22 1:35 ` Jakub Kicinski
2026-01-22 2:37 ` Bobby Eshleman
2026-01-22 2:50 ` Jakub Kicinski
2026-01-22 3:25 ` Bobby Eshleman
2026-01-22 3:46 ` Jakub Kicinski
2026-01-22 4:07 ` Stanislav Fomichev
2026-01-27 1:26 ` Jakub Kicinski
2026-01-27 2:30 ` Bobby Eshleman
2026-01-27 2:44 ` Jakub Kicinski
2026-01-27 3:06 ` Bobby Eshleman
2026-01-27 3:43 ` Jakub Kicinski
2026-01-27 3:50 ` Bobby Eshleman
2026-01-16 5:02 ` [PATCH net-next v10 5/5] selftests: drv-net: devmem: add autorelease tests Bobby Eshleman
2026-01-21 1:07 ` [PATCH net-next v10 0/5] net: devmem: improve cpu cost of RX token management Jakub Kicinski
2026-01-21 5:29 ` Bobby Eshleman
2026-01-22 1:37 ` Jakub Kicinski
2026-01-22 4:21 ` Mina Almasry
2026-01-26 18:45 ` Bobby Eshleman [this message]
2026-01-27 1:31 ` Jakub Kicinski
2026-01-27 6:00 ` Stanislav Fomichev
2026-01-27 6:48 ` Bobby Eshleman
2026-01-30 11:13 ` Pavel Begunkov
2026-02-05 3:48 ` Jens Axboe
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=aXe2QhzL4DoVbesQ@devvm11784.nha0.facebook.com \
--to=bobbyeshleman@gmail.com \
--cc=almasrymina@google.com \
--cc=andrew+netdev@lunn.ch \
--cc=arnd@arndb.de \
--cc=asml.silence@gmail.com \
--cc=bobbyeshleman@meta.com \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=donald.hunter@gmail.com \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=kuniyu@google.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=matttbe@kernel.org \
--cc=ncardwell@google.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sdf@fomichev.me \
--cc=shuah@kernel.org \
--cc=skhawaja@google.com \
--cc=willemb@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