From: netdev-bot+sashiko@kernel.org
To: almasrymina@google.com
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-rdma@vger.kernel.org, bpf@vger.kernel.org,
ayush.sawal@chelsio.com, andrew+netdev@lunn.ch,
davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
pabeni@redhat.com, tariqt@nvidia.com, horms@kernel.org,
steffen.klassert@secunet.com, herbert@gondor.apana.org.au,
ncardwell@google.com, kuniyu@google.com,
john.fastabend@gmail.com, sd@queasysnail.net,
ebiggers@kernel.org, kees@kernel.org,
aleksandr.loktionov@intel.com, u.kleine-koenig@baylibre.com,
shaojijie@huawei.com, mgr@kernel.org, j.raczynski@samsung.com
Subject: Re: [PATCH net-next v2 1/6] netmem: rename __get/__put_netmem() to get/put_net_iov()
Date: Tue, 13 Oct 2026 08:34:51 +0000 [thread overview]
Message-ID: <179188049192.434549.15748478382519808076@kernel.org> (raw)
In-Reply-To: <20261012082148.1698596-2-almasrymina@google.com>
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] The new kernel-doc for get_netmem() and put_netmem() in
include/net/netmem.h is wrong for one of the two net_iov types.
--
netmem: rename __get/__put_netmem() to get/put_net_iov()
This commit renames __get_netmem()/__put_netmem() to get_net_iov() and
put_net_iov(), changing them to take a struct net_iov pointer. It adds
kernel-doc to get_netmem()/put_netmem() and the new helpers, and adds a
DEBUG_NET_WARN_ON_ONCE() for net_iov types without non-pp reference
support.
> diff --git a/include/net/netmem.h b/include/net/netmem.h
> index 0cc8572f62caf..697d50c51a5ee 100644
> --- a/include/net/netmem.h
> +++ b/include/net/netmem.h
> @@ -399,21 +399,37 @@ static inline bool net_is_devmem_iov(const struct net_iov *niov)
> }
> #endif
>
> -void __get_netmem(netmem_ref netmem);
> -void __put_netmem(netmem_ref netmem);
> +void get_net_iov(struct net_iov *niov);
> +void put_net_iov(struct net_iov *niov);
>
> +/**
> + * get_netmem - acquire a non-page_pool reference on a netmem
> + * @netmem: netmem to reference
> + *
> + * Acquires a non-pp backing reference (page._refcount via get_page() or
> + * binding->ref via get_net_iov()) regardless of page_pool membership.
> + * Counterpart to put_netmem().
> + */
[Severity: Low]
Is this kernel-doc accurate for every net_iov type?
get_net_iov() only takes a reference when net_is_devmem_iov() is true,
which means the NET_IOV_DMABUF type:
net/core/skbuff.c:get_net_iov() {
if (net_is_devmem_iov(niov))
net_devmem_get_net_iov(niov);
else
DEBUG_NET_WARN_ON_ONCE(true);
}
For NET_IOV_IOURING (io_uring zcrx) niovs, and for all niovs when
CONFIG_NET_DEVMEM=n, neither get_netmem() nor put_netmem() takes or drops
any reference.
Without CONFIG_DEBUG_NET, DEBUG_NET_WARN_ON_ONCE() expands to
BUILD_BUG_ON_INVALID(). On production kernels that case is skipped
silently, so the "warning if @niov does not support non-pp references"
in the get_net_iov()/put_net_iov() kernel-doc never fires there.
The commit message has a similar statement:
Make the non-pp layer explicit and symmetric across both
netmem types: get/put_netmem() dispatches to get/put_page() for pages
and get/put_net_iov() for net_iovs, always acquiring or releasing a
non-pp reference regardless of page_pool membership.
This doesn't change runtime behavior, since __get_netmem()/__put_netmem()
also did nothing for io_uring niovs. A future caller that relies on this
kernel-doc could still pair get_netmem()/put_netmem() on a zcrx niov and
get no lifetime protection.
Could the get_netmem()/put_netmem() kernel-doc say that NET_IOV_IOURING
has no non-pp refcount, so these helpers do nothing for it? It could also
say that the warning only exists under CONFIG_DEBUG_NET.
> static __always_inline void get_netmem(netmem_ref netmem)
> {
> if (netmem_is_net_iov(netmem))
> - __get_netmem(netmem);
> + get_net_iov(netmem_to_net_iov(netmem));
> else
> get_page(netmem_to_page(netmem));
> }
>
> +/**
> + * put_netmem - release a non-page_pool reference on a netmem
> + * @netmem: netmem to unreference
> + *
> + * Drops a non-pp backing reference (page._refcount via put_page() or
> + * binding->ref via put_net_iov()) regardless of page_pool membership.
> + * Counterpart to get_netmem().
> + */
The same question applies to put_netmem(). put_net_iov() only calls
net_devmem_put_net_iov() for NET_IOV_DMABUF niovs.
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261012082148.1698596-1-almasrymina%40google.com
next prev parent reply other threads:[~2026-10-13 8:34 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-12 8:21 [PATCH net-next v2 0/6] net: unify symmetric netmem and page_pool refcounting Mina Almasry
2026-10-12 8:21 ` [PATCH net-next v2 1/6] netmem: rename __get/__put_netmem() to get/put_net_iov() Mina Almasry
2026-10-13 8:34 ` netdev-bot+sashiko [this message]
2026-10-12 8:21 ` [PATCH net-next v2 2/6] net: skbuff: add napi_pp_get_page() and use it in tcp_recvmsg_dmabuf() Mina Almasry
2026-10-12 8:21 ` [PATCH net-next v2 3/6] net: skbuff: replace skb_page_unref() and __skb_frag_unref() with skb_netmem_unref() Mina Almasry
2026-10-13 8:34 ` netdev-bot+sashiko
2026-10-13 16:29 ` Mina Almasry
2026-10-12 8:21 ` [PATCH net-next v2 4/6] net: skbuff: replace __skb_frag_ref() with symmetric skb_netmem_ref() Mina Almasry
2026-10-13 8:34 ` netdev-bot+sashiko
2026-10-12 8:21 ` [PATCH net-next v2 5/6] net: skbuff: use skb_frag_ref() in skb_try_coalesce() Mina Almasry
2026-10-12 8:21 ` [PATCH net-next v2 6/6] net: kunit: test netmem, page_pool, and skb frag refcounting Mina Almasry
2026-10-13 8:34 ` netdev-bot+sashiko
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=179188049192.434549.15748478382519808076@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=aleksandr.loktionov@intel.com \
--cc=almasrymina@google.com \
--cc=andrew+netdev@lunn.ch \
--cc=ayush.sawal@chelsio.com \
--cc=bpf@vger.kernel.org \
--cc=davem@davemloft.net \
--cc=ebiggers@kernel.org \
--cc=edumazet@kernel.org \
--cc=herbert@gondor.apana.org.au \
--cc=horms@kernel.org \
--cc=j.raczynski@samsung.com \
--cc=john.fastabend@gmail.com \
--cc=kees@kernel.org \
--cc=kuba@kernel.org \
--cc=kuniyu@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=mgr@kernel.org \
--cc=ncardwell@google.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sd@queasysnail.net \
--cc=shaojijie@huawei.com \
--cc=steffen.klassert@secunet.com \
--cc=tariqt@nvidia.com \
--cc=u.kleine-koenig@baylibre.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
all inboxes | Powered by JetHome®