Skip to content

Commit 6bd8614

Browse files
Frederik Deweerdtkuba-moo
authored andcommitted
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` Cc: [email protected] Signed-off-by: Frederik Deweerdt <[email protected]> Fixes: 2e910b9 ("net: Add a function to splice pages into an skbuff for MSG_SPLICE_PAGES") Reviewed-by: Kuniyuki Iwashima <[email protected]> Reviewed-by: Eric Dumazet <[email protected]> Reviewed-by: Joe Damato <[email protected]> Link: https://patch.msgid.link/Z1fMaHkRf8cfubuE@xiberoa Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 3b58b53 commit 6bd8614

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

net/unix/af_unix.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2313,6 +2313,7 @@ static int unix_stream_sendmsg(struct socket *sock, struct msghdr *msg,
23132313
fds_sent = true;
23142314

23152315
if (unlikely(msg->msg_flags & MSG_SPLICE_PAGES)) {
2316+
skb->ip_summed = CHECKSUM_UNNECESSARY;
23162317
err = skb_splice_from_iter(skb, &msg->msg_iter, size,
23172318
sk->sk_allocation);
23182319
if (err < 0) {

0 commit comments

Comments
 (0)