netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] splice: do not checksum AF_UNIX sockets
@ 2024-11-29 23:20 Frederik Deweerdt
  2024-11-30  1:43 ` Cong Wang
  2024-12-03 16:30 ` David Howells
  0 siblings, 2 replies; 7+ messages in thread
From: Frederik Deweerdt @ 2024-11-29 23:20 UTC (permalink / raw)
  To: netdev; +Cc: dhowells

When `skb_splice_from_iter` was introduced, it inadvertently added
checksumming for AF_UNIX sockets. This resulted in significant
slowdowns, as when using sendfile over unix sockets.

Using the test code [1] in my test setup (2G, single core x86_64 qemu),
the client receives a 1000M file in:
- without the patch: 1577ms (+/- 36.1ms)
- with the patch: 725ms (+/- 28.3ms)

This commit skips addresses the issue by skipping checksumming when
splice occurs a AF_UNIX socket.

[1] https://gist.github.com/deweerdt/a3ee2477d1d87524cf08618d3c179f06

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/core/skbuff.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 6841e61a6bd0..49e4f9ab625f 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -7233,7 +7233,7 @@ ssize_t skb_splice_from_iter(struct sk_buff *skb, struct iov_iter *iter,
 				goto out;
 			}
 
-			if (skb->ip_summed == CHECKSUM_NONE)
+			if (skb->ip_summed == CHECKSUM_NONE && skb->sk->sk_family != AF_UNIX)
 				skb_splice_csum_page(skb, page, off, part);
 
 			off = 0;
-- 
2.44.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-12-03 22:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-29 23:20 [PATCH net] splice: do not checksum AF_UNIX sockets Frederik Deweerdt
2024-11-30  1:43 ` Cong Wang
2024-11-30  4:05   ` Frederik Deweerdt
2024-11-30 12:08   ` David Laight
2024-12-03 16:30 ` David Howells
2024-12-03 21:48   ` Cong Wang
2024-12-03 22:35     ` Frederik Deweerdt

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).