* Re: [PATCH v2 net] splice: do not checksum AF_UNIX sockets
2024-12-10 5:06 [PATCH v2 net] splice: do not checksum AF_UNIX sockets Frederik Deweerdt
@ 2024-12-10 8:17 ` Kuniyuki Iwashima
2024-12-10 16:10 ` Frederik Deweerdt
2024-12-10 16:12 ` Eric Dumazet
` (2 subsequent siblings)
3 siblings, 1 reply; 6+ messages in thread
From: Kuniyuki Iwashima @ 2024-12-10 8:17 UTC (permalink / raw)
To: deweerdt.lkml
Cc: David.Laight, davem, dhowells, edumazet, horms, jdamato, kuba,
kuniyu, linux-kernel, mhal, netdev, pabeni, stable,
xiyou.wangcong
From: Frederik Deweerdt <deweerdt.lkml@gmail.com>
Date: Mon, 9 Dec 2024 21:06:48 -0800
> When `skb_splice_from_iter` was introduced, it inadvertently added
> checksumming for AF_UNIX sockets. This resulted in significant
> slowdowns, for example when using sendfile over unix sockets.
>
> Using the test code in [1] in my test setup (2G single core qemu),
> the client receives a 1000M file in:
> - without the patch: 1482ms (+/- 36ms)
> - with the patch: 652.5ms (+/- 22.9ms)
>
> This commit addresses the issue by marking checksumming as unnecessary in
> `unix_stream_sendmsg`
>
> Cc: stable@vger.kernel.org
> Signed-off-by: Frederik Deweerdt <deweerdt.lkml@gmail.com>
> Fixes: 2e910b95329c ("net: Add a function to splice pages into an skbuff for MSG_SPLICE_PAGES")
> ---
For the future submission, it would be nice to explain changes
between versions and add the old patch link under '---' here.
The patch itself looks good to me.
Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
> net/unix/af_unix.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
> index 001ccc55ef0f..6b1762300443 100644
> --- a/net/unix/af_unix.c
> +++ b/net/unix/af_unix.c
> @@ -2313,6 +2313,7 @@ static int unix_stream_sendmsg(struct socket *sock, struct msghdr *msg,
> fds_sent = true;
>
> if (unlikely(msg->msg_flags & MSG_SPLICE_PAGES)) {
> + skb->ip_summed = CHECKSUM_UNNECESSARY;
> err = skb_splice_from_iter(skb, &msg->msg_iter, size,
> sk->sk_allocation);
> if (err < 0) {
> --
> 2.44.1
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH v2 net] splice: do not checksum AF_UNIX sockets
2024-12-10 8:17 ` Kuniyuki Iwashima
@ 2024-12-10 16:10 ` Frederik Deweerdt
0 siblings, 0 replies; 6+ messages in thread
From: Frederik Deweerdt @ 2024-12-10 16:10 UTC (permalink / raw)
To: Kuniyuki Iwashima
Cc: David.Laight, davem, dhowells, edumazet, horms, jdamato, kuba,
linux-kernel, mhal, netdev, pabeni, stable, xiyou.wangcong
On Tue, Dec 10, 2024 at 05:17:21PM +0900, Kuniyuki Iwashima wrote:
> From: Frederik Deweerdt <deweerdt.lkml@gmail.com>
> Date: Mon, 9 Dec 2024 21:06:48 -0800
> > When `skb_splice_from_iter` was introduced, it inadvertently added
> > checksumming for AF_UNIX sockets. This resulted in significant
> > slowdowns, for example when using sendfile over unix sockets.
> >
> > Using the test code in [1] in my test setup (2G single core qemu),
> > the client receives a 1000M file in:
> > - without the patch: 1482ms (+/- 36ms)
> > - with the patch: 652.5ms (+/- 22.9ms)
> >
> > This commit addresses the issue by marking checksumming as unnecessary in
> > `unix_stream_sendmsg`
> >
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Frederik Deweerdt <deweerdt.lkml@gmail.com>
> > Fixes: 2e910b95329c ("net: Add a function to splice pages into an skbuff for MSG_SPLICE_PAGES")
> > ---
>
> For the future submission, it would be nice to explain changes
> between versions and add the old patch link under '---' here.
>
Will do, thank you.
> The patch itself looks good to me.
>
> Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
>
Thanks!
Frederik
> > net/unix/af_unix.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
> > index 001ccc55ef0f..6b1762300443 100644
> > --- a/net/unix/af_unix.c
> > +++ b/net/unix/af_unix.c
> > @@ -2313,6 +2313,7 @@ static int unix_stream_sendmsg(struct socket *sock, struct msghdr *msg,
> > fds_sent = true;
> >
> > if (unlikely(msg->msg_flags & MSG_SPLICE_PAGES)) {
> > + skb->ip_summed = CHECKSUM_UNNECESSARY;
> > err = skb_splice_from_iter(skb, &msg->msg_iter, size,
> > sk->sk_allocation);
> > if (err < 0) {
> > --
> > 2.44.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 net] splice: do not checksum AF_UNIX sockets
2024-12-10 5:06 [PATCH v2 net] splice: do not checksum AF_UNIX sockets Frederik Deweerdt
2024-12-10 8:17 ` Kuniyuki Iwashima
@ 2024-12-10 16:12 ` Eric Dumazet
2024-12-10 16:28 ` Joe Damato
2024-12-12 4:30 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 6+ messages in thread
From: Eric Dumazet @ 2024-12-10 16:12 UTC (permalink / raw)
To: Frederik Deweerdt
Cc: netdev, David S. Miller, Jakub Kicinski, Paolo Abeni,
Simon Horman, Kuniyuki Iwashima, Michal Luczaj, David Howells,
linux-kernel, xiyou.wangcong, David.Laight, jdamato, stable
On Tue, Dec 10, 2024 at 6:06 AM Frederik Deweerdt
<deweerdt.lkml@gmail.com> wrote:
>
> When `skb_splice_from_iter` was introduced, it inadvertently added
> checksumming for AF_UNIX sockets. This resulted in significant
> slowdowns, for example when using sendfile over unix sockets.
>
> Using the test code in [1] in my test setup (2G single core qemu),
> the client receives a 1000M file in:
> - without the patch: 1482ms (+/- 36ms)
> - with the patch: 652.5ms (+/- 22.9ms)
>
> This commit addresses the issue by marking checksumming as unnecessary in
> `unix_stream_sendmsg`
>
> Cc: stable@vger.kernel.org
> Signed-off-by: Frederik Deweerdt <deweerdt.lkml@gmail.com>
> Fixes: 2e910b95329c ("net: Add a function to splice pages into an skbuff for MSG_SPLICE_PAGES")
> ---
Reviewed-by: Eric Dumazet <edumazet@google.com>
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH v2 net] splice: do not checksum AF_UNIX sockets
2024-12-10 5:06 [PATCH v2 net] splice: do not checksum AF_UNIX sockets Frederik Deweerdt
2024-12-10 8:17 ` Kuniyuki Iwashima
2024-12-10 16:12 ` Eric Dumazet
@ 2024-12-10 16:28 ` Joe Damato
2024-12-12 4:30 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 6+ messages in thread
From: Joe Damato @ 2024-12-10 16:28 UTC (permalink / raw)
To: Frederik Deweerdt
Cc: netdev, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Simon Horman, Kuniyuki Iwashima, Michal Luczaj,
David Howells, linux-kernel, xiyou.wangcong, David.Laight, stable
On Mon, Dec 09, 2024 at 09:06:48PM -0800, Frederik Deweerdt wrote:
> When `skb_splice_from_iter` was introduced, it inadvertently added
> checksumming for AF_UNIX sockets. This resulted in significant
> slowdowns, for example when using sendfile over unix sockets.
>
> Using the test code in [1] in my test setup (2G single core qemu),
> the client receives a 1000M file in:
> - without the patch: 1482ms (+/- 36ms)
> - with the patch: 652.5ms (+/- 22.9ms)
>
> This commit addresses the issue by marking checksumming as unnecessary in
> `unix_stream_sendmsg`
>
> Cc: stable@vger.kernel.org
> Signed-off-by: Frederik Deweerdt <deweerdt.lkml@gmail.com>
> Fixes: 2e910b95329c ("net: Add a function to splice pages into an skbuff for MSG_SPLICE_PAGES")
> ---
> net/unix/af_unix.c | 1 +
> 1 file changed, 1 insertion(+)
Reviewed-by: Joe Damato <jdamato@fastly.com>
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH v2 net] splice: do not checksum AF_UNIX sockets
2024-12-10 5:06 [PATCH v2 net] splice: do not checksum AF_UNIX sockets Frederik Deweerdt
` (2 preceding siblings ...)
2024-12-10 16:28 ` Joe Damato
@ 2024-12-12 4:30 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-12-12 4:30 UTC (permalink / raw)
To: Frederik Deweerdt
Cc: netdev, davem, edumazet, kuba, pabeni, horms, kuniyu, mhal,
dhowells, linux-kernel, xiyou.wangcong, David.Laight, jdamato,
stable
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Mon, 9 Dec 2024 21:06:48 -0800 you wrote:
> When `skb_splice_from_iter` was introduced, it inadvertently added
> checksumming for AF_UNIX sockets. This resulted in significant
> slowdowns, for example when using sendfile over unix sockets.
>
> Using the test code in [1] in my test setup (2G single core qemu),
> the client receives a 1000M file in:
> - without the patch: 1482ms (+/- 36ms)
> - with the patch: 652.5ms (+/- 22.9ms)
>
> [...]
Here is the summary with links:
- [v2,net] splice: do not checksum AF_UNIX sockets
https://git.kernel.org/netdev/net/c/6bd8614fc2d0
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] 6+ messages in thread