* [PATCH net-next v5] net: avoid one loop iteration in __skb_splice_bits
@ 2025-08-19 2:15 Pengtao He
2025-08-19 13:55 ` Willem de Bruijn
2025-08-21 2:30 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Pengtao He @ 2025-08-19 2:15 UTC (permalink / raw)
To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, Willem de Bruijn, Mina Almasry, Jason Xing,
Michal Luczaj, Eric Biggers, Alexander Lobakin
Cc: netdev, linux-kernel, Pengtao He
If *len is equal to 0 at the beginning of __splice_segment
it returns true directly. But when decreasing *len from
a positive number to 0 in __splice_segment, it returns false.
The __skb_splice_bits needs to call __splice_segment again.
Recheck *len if it changes, return true in time.
Reduce unnecessary calls to __splice_segment.
Signed-off-by: Pengtao He <hept.hept.hept@gmail.com>
---
v5:
Correct the summary phrase.
v4:
Correct the commit message.
v3:
Reduce once condition evaluation.
v2:
Correct the commit message and target tree.
v1:
https://lore.kernel.org/netdev/20250723063119.24059-1-hept.hept.hept@gmail.com/
---
net/core/skbuff.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index ee0274417948..23b776cd9879 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -3112,7 +3112,9 @@ static bool __splice_segment(struct page *page, unsigned int poff,
poff += flen;
plen -= flen;
*len -= flen;
- } while (*len && plen);
+ if (!*len)
+ return true;
+ } while (plen);
return false;
}
--
2.49.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next v5] net: avoid one loop iteration in __skb_splice_bits
2025-08-19 2:15 [PATCH net-next v5] net: avoid one loop iteration in __skb_splice_bits Pengtao He
@ 2025-08-19 13:55 ` Willem de Bruijn
2025-08-21 2:30 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Willem de Bruijn @ 2025-08-19 13:55 UTC (permalink / raw)
To: Pengtao He, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Simon Horman, Willem de Bruijn, Mina Almasry,
Jason Xing, Michal Luczaj, Eric Biggers, Alexander Lobakin
Cc: netdev, linux-kernel, Pengtao He
Pengtao He wrote:
> If *len is equal to 0 at the beginning of __splice_segment
> it returns true directly. But when decreasing *len from
> a positive number to 0 in __splice_segment, it returns false.
> The __skb_splice_bits needs to call __splice_segment again.
>
> Recheck *len if it changes, return true in time.
> Reduce unnecessary calls to __splice_segment.
>
> Signed-off-by: Pengtao He <hept.hept.hept@gmail.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next v5] net: avoid one loop iteration in __skb_splice_bits
2025-08-19 2:15 [PATCH net-next v5] net: avoid one loop iteration in __skb_splice_bits Pengtao He
2025-08-19 13:55 ` Willem de Bruijn
@ 2025-08-21 2:30 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-08-21 2:30 UTC (permalink / raw)
To: Pengtao He
Cc: davem, edumazet, kuba, pabeni, horms, willemb, almasrymina,
kerneljasonxing, mhal, ebiggers, aleksander.lobakin, netdev,
linux-kernel
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Tue, 19 Aug 2025 10:15:51 +0800 you wrote:
> If *len is equal to 0 at the beginning of __splice_segment
> it returns true directly. But when decreasing *len from
> a positive number to 0 in __splice_segment, it returns false.
> The __skb_splice_bits needs to call __splice_segment again.
>
> Recheck *len if it changes, return true in time.
> Reduce unnecessary calls to __splice_segment.
>
> [...]
Here is the summary with links:
- [net-next,v5] net: avoid one loop iteration in __skb_splice_bits
https://git.kernel.org/netdev/net-next/c/8f2c72f2252c
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-08-21 2:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-19 2:15 [PATCH net-next v5] net: avoid one loop iteration in __skb_splice_bits Pengtao He
2025-08-19 13:55 ` Willem de Bruijn
2025-08-21 2:30 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).