Thread (5 messages) 5 messages, 4 authors, 6d ago

Re: [PATCH net-next v2] net: skbuff: optimization of net_zcopy_get() call in pskb_carve helpers

From: luyun <hidden>
Date: 2026-07-22 07:20:01

在 2026/7/21 17:39, Paolo Abeni 写道:
On 7/8/26 7:54 AM, Yun Lu wrote:
quoted
From: Yun Lu <redacted>

Commit 98d0912e9f84 ("net: skbuff: fix missing zerocopy reference in
pskb_carve helpers") introduced two calls of net_zcopy_get(skb_zcopy(skb)).
In fact, skb_zcopy() has already been executed once before. When calling
net_zcopy_get(), skb_zcopy() always returns skb_uarg(skb), which results
in adding some unnecessary instructions in skb_zcopy.
I'm quite surprised the compiler can't generate the same binary with the
old code. blot-o-meter seams to agree with me.
Thanks for checking with bloat-o-meter — you’re right. I did the measurement

I should have done earlier: I compiled net/core/skbuff.o with and without

this patch (gcc 9.3.0, x86-64 defconfig-based build) and diffed the

disassembly of pskb_expand_head() and pskb_carve() (into which the two

static helpers are inlined). The generated code is byte-for-byte identical,

so the compiler does fold skb_zcopy() into skb_uarg(skb) on its own.
I think that the consistency argument is enough here to justify the
patch, but it would have been better to double the above guess with some
actual measurement.

/P
This patch is only a code-consistency cleanup, with no instruction-level 
optimization.

Thank you for pointing that out — I’ll be more rigorous next time.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help