splice: do not checksum AF_UNIX sockets
Subsystems (4)
PATCH v2 1/1 splice: do not checksum AF_UNIX sockets
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
--- net/unix/af_unix.c | 1 + 1 file changed, 1 insertion(+)
net/unix/af_unix.c +1 -0
@@ -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 ) {
Signature · 1 line
2.44.1
From: Frederik Deweerdt <[email protected]>
Date: Mon, 9 Dec 2024 21:06:48 -0800
Quoted 9 lines
When
skb_splice_from_iterwas introduced, it inadvertently added checksumming forAF_UNIXsockets. 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)
Quoted 7 lines
This commit addresses the issue by marking checksumming as unnecessary in
unix_stream_sendmsgSigned-off-by Frederik Deweerdt <[email protected]>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.
Quoted 17 lines
net/unix/af_unix.c | 1 + 1 file changed, 1 insertion(+)net/unix/af_unix.c +1
-0@@ -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 ) {Signature · 1 line
2.44.1
Quoted 14 lines · Kuniyuki Iwashima
From: Frederik Deweerdt <[email protected]>
Date: Mon, 9 Dec 2024 21:06:48 -0800Quoted 12 lines
When
skb_splice_from_iterwas introduced, it inadvertently added checksumming forAF_UNIXsockets. 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
Quoted 8 lines
Quoted 4 lines
Signed-off-by Frederik Deweerdt <[email protected]>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.
Quoted 4 lines
The patch itself looks good to me.
Reviewed-by Kuniyuki Iwashima <[email protected]>
Thanks!
Frederik
Quoted 17 lines
Quoted 17 lines
net/unix/af_unix.c | 1 + 1 file changed, 1 insertion(+)net/unix/af_unix.c +1
-0@@ -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 ) {Signature · 1 line
2.44.1
Quoted 10 lines · Frederik Deweerdt
When
skb_splice_from_iterwas introduced, it inadvertently added checksumming forAF_UNIXsockets. 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)
Quoted 7 lines
This commit addresses the issue by marking checksumming as unnecessary in
unix_stream_sendmsgSigned-off-by Frederik Deweerdt <[email protected]>Fixes 2e910b95329c ("net: Add a function to splice pages into an skbuff for MSG_SPLICE_PAGES")---
Quoted 12 lines · Frederik Deweerdt
When
skb_splice_from_iterwas introduced, it inadvertently added checksumming forAF_UNIXsockets. 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
Quoted 6 lines
Signed-off-by Frederik Deweerdt <[email protected]>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(+)
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 10 lines · On Mon, 9 Dec 2024 21:06:48 -0800 you wrote:
When
skb_splice_from_iterwas introduced, it inadvertently added checksumming forAF_UNIXsockets. 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!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html