Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next] net: skbuff: use net_zcopy_get() instead of refcount_inc()
@ 2026-07-06 10:02 Yun Lu
  2026-07-06 13:55 ` Willem de Bruijn
  0 siblings, 1 reply; 2+ messages in thread
From: Yun Lu @ 2026-07-06 10:02 UTC (permalink / raw)
  To: davem, edumazet, kuba, pabeni, horms, kerneljasonxing, kuniyu
  Cc: mhal, bjorn, jiayuan.chen, netdev

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));
 		for (i = 0; i < skb_shinfo(skb)->nr_frags; i++)
 			skb_frag_ref(skb, i);
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next] net: skbuff: use net_zcopy_get() instead of refcount_inc()
  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
  0 siblings, 0 replies; 2+ messages in thread
From: Willem de Bruijn @ 2026-07-06 13:55 UTC (permalink / raw)
  To: Yun Lu, davem, edumazet, kuba, pabeni, horms, kerneljasonxing,
	kuniyu
  Cc: mhal, bjorn, jiayuan.chen, netdev, minhnguyen.080505

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-07-06 13:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox