Skip to content

Commit

Permalink
udp6: shuffle up->pending AF_INET bits
Browse files Browse the repository at this point in the history
Corked AF_INET for ipv6 socket doesn't appear to be the hottest case,
so move it out of the common path under up->pending check to remove
overhead.

Signed-off-by: Pavel Begunkov <[email protected]>
Reviewed-by: Willem de Bruijn <[email protected]>
Signed-off-by: Jakub Kicinski <[email protected]>
  • Loading branch information
isilence authored and kuba-moo committed Jan 28, 2022
1 parent cd3c748 commit 406c4a0
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions net/ipv6/udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1363,9 +1363,6 @@ int udpv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
}
}

if (up->pending == AF_INET)
return udp_sendmsg(sk, msg, len);

/* Rough check on arithmetic overflow,
better check is made in ip6_append_data().
*/
Expand All @@ -1374,6 +1371,8 @@ int udpv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)

getfrag = is_udplite ? udplite_getfrag : ip_generic_getfrag;
if (up->pending) {
if (up->pending == AF_INET)
return udp_sendmsg(sk, msg, len);
/*
* There are pending frames.
* The socket lock must be held while it's corked.
Expand Down

0 comments on commit 406c4a0

Please sign in to comment.