From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: luyun <luyun_611@163.com>,
Willem de Bruijn <willemdebruijn.kernel@gmail.com>,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, horms@kernel.org,
kerneljasonxing@gmail.com, kuniyu@google.com
Cc: mhal@rbox.co, bjorn@kernel.org, jiayuan.chen@linux.dev,
netdev@vger.kernel.org, minhnguyen.080505@gmail.com
Subject: Re: [PATCH net-next] net: skbuff: use net_zcopy_get() instead of refcount_inc()
Date: Tue, 07 Jul 2026 11:18:54 -0400 [thread overview]
Message-ID: <willemdebruijn.kernel.c29ee6a560e5@gmail.com> (raw)
In-Reply-To: <dbcfecb3-7b5e-4d53-b4ac-486fded1e192@163.com>
luyun wrote:
>
> 在 2026/7/6 21:55, Willem de Bruijn 写道:
> > Yun Lu wrote:
> >> From: Yun Lu <luyun@kylinos.cn>
> >>
> >> The net_zcopy_get() increments the uarg->refcnt, which is called both
> >> in pskb_carve_inside_header() and pskb_carve_inside_nonlinear().
> >> Also use net_zcopy_get() in pskb_expand_head for code consistency.
> >>
> >> No functional change intended.
> >>
> >> Signed-off-by: Yun Lu <luyun@kylinos.cn>
> >> ---
> >> net/core/skbuff.c | 2 +-
> >> 1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/net/core/skbuff.c b/net/core/skbuff.c
> >> index 18dabb4e9cfa..bcf3b2c65fb9 100644
> >> --- a/net/core/skbuff.c
> >> +++ b/net/core/skbuff.c
> >> @@ -2326,7 +2326,7 @@ int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail,
> >> if (skb_orphan_frags(skb, gfp_mask))
> >> goto nofrags;
> >> if (skb_zcopy(skb))
> >> - refcount_inc(&skb_uarg(skb)->refcnt);
> >> + net_zcopy_get(skb_zcopy(skb));
> > This adds some unnecessary instructions in skb_zcopy.
> >
> > It's not terrible and I see the consistency argument. But would make
> > more sense to update the recently added pskb_carve_.. variants instead.
>
> Thanks for your review.
>
> The skb_zcopy() does indeed make repeated checks. So following your
> suggestion,
>
> I have modified the code as follows:
>
> - net_zcopy_get(skb_zcopy(skb));
> + net_zcopy_get(skb_uarg(skb));
>
> Does it seem more reasonable?
>
> And I plan to modify all three functions in patch version 2.
>
That sounds good to me, thanks.
prev parent reply other threads:[~2026-07-07 15:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-06 10:02 [PATCH net-next] net: skbuff: use net_zcopy_get() instead of refcount_inc() Yun Lu
2026-07-06 13:55 ` Willem de Bruijn
2026-07-07 2:36 ` luyun
2026-07-07 15:18 ` Willem de Bruijn [this message]
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=willemdebruijn.kernel.c29ee6a560e5@gmail.com \
--to=willemdebruijn.kernel@gmail.com \
--cc=bjorn@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=jiayuan.chen@linux.dev \
--cc=kerneljasonxing@gmail.com \
--cc=kuba@kernel.org \
--cc=kuniyu@google.com \
--cc=luyun_611@163.com \
--cc=mhal@rbox.co \
--cc=minhnguyen.080505@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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