* [PATCH] net/core: fix wrong return value in __splice_segment
@ 2025-07-23 6:31 Pengtao He
2025-07-23 13:28 ` Willem de Bruijn
0 siblings, 1 reply; 3+ messages in thread
From: Pengtao He @ 2025-07-23 6:31 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
Return true immediately when the last segment is processed,
without waiting for the next segment.
Signed-off-by: Pengtao He <hept.hept.hept@gmail.com>
---
net/core/skbuff.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index ee0274417948..cc3339ab829a 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -3114,6 +3114,9 @@ static bool __splice_segment(struct page *page, unsigned int poff,
*len -= flen;
} while (*len && plen);
+ if (!*len)
+ return true;
+
return false;
}
--
2.49.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] net/core: fix wrong return value in __splice_segment
2025-07-23 6:31 [PATCH] net/core: fix wrong return value in __splice_segment Pengtao He
@ 2025-07-23 13:28 ` Willem de Bruijn
2025-07-24 10:06 ` Pengtao He
0 siblings, 1 reply; 3+ messages in thread
From: Willem de Bruijn @ 2025-07-23 13:28 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:
> Return true immediately when the last segment is processed,
> without waiting for the next segment.
This can use a bit more explanation. Which unnecessary wait is
avoided.
The boolean return from __skb_splice_bits has a bit odd semantics. But
is ignored by its only caller anyway.
The relevant __splice_segment that can cause an early return is in the
frags loop. But I see no waiting operation in here.
Aside from that, the commit also should target [PATCH net-next],
assuuming that this is an optimization, not a fix.
>
> Signed-off-by: Pengtao He <hept.hept.hept@gmail.com>
> ---
> net/core/skbuff.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/net/core/skbuff.c b/net/core/skbuff.c
> index ee0274417948..cc3339ab829a 100644
> --- a/net/core/skbuff.c
> +++ b/net/core/skbuff.c
> @@ -3114,6 +3114,9 @@ static bool __splice_segment(struct page *page, unsigned int poff,
> *len -= flen;
> } while (*len && plen);
>
> + if (!*len)
> + return true;
> +
> return false;
> }
>
> --
> 2.49.0
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net/core: fix wrong return value in __splice_segment
2025-07-23 13:28 ` Willem de Bruijn
@ 2025-07-24 10:06 ` Pengtao He
0 siblings, 0 replies; 3+ messages in thread
From: Pengtao He @ 2025-07-24 10:06 UTC (permalink / raw)
To: willemdebruijn.kernel
Cc: aleksander.lobakin, almasrymina, davem, ebiggers, edumazet,
hept.hept.hept, horms, kerneljasonxing, kuba, linux-kernel, mhal,
netdev, pabeni, willemb
> Pengtao He wrote:
> > Return true immediately when the last segment is processed,
> > without waiting for the next segment.
>
> This can use a bit more explanation. Which unnecessary wait is
> avoided.
>
> The boolean return from __skb_splice_bits has a bit odd semantics. But
> is ignored by its only caller anyway.
>
> The relevant __splice_segment that can cause an early return is in the
> frags loop. But I see no waiting operation in here.
Sorry, I didn't express it clearly.
There is no wait operation, just avoid to walking once more
in the frags loop before return true.
>
> Aside from that, the commit also should target [PATCH net-next],
> assuuming that this is an optimization, not a fix.
Ok, the prefix [PATCH net-next] will be used.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-07-24 10:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-23 6:31 [PATCH] net/core: fix wrong return value in __splice_segment Pengtao He
2025-07-23 13:28 ` Willem de Bruijn
2025-07-24 10:06 ` Pengtao He
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).