Commit d21dbdfe authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

udp: avoid one cache line miss in recvmsg()

UDP_SKB_CB(skb)->partial_cov is located at offset 66 in skb,
requesting a cold cache line being read in cpu cache.

We can avoid this cache line miss for UDP sockets,
as partial_cov has a meaning only for UDPLite.
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ee9d5461
...@@ -1389,7 +1389,8 @@ int udp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int noblock, ...@@ -1389,7 +1389,8 @@ int udp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int noblock,
* coverage checksum (UDP-Lite), do it before the copy. * coverage checksum (UDP-Lite), do it before the copy.
*/ */
if (copied < ulen || UDP_SKB_CB(skb)->partial_cov || peeking) { if (copied < ulen || peeking ||
(is_udplite && UDP_SKB_CB(skb)->partial_cov)) {
checksum_valid = !udp_lib_checksum_complete(skb); checksum_valid = !udp_lib_checksum_complete(skb);
if (!checksum_valid) if (!checksum_valid)
goto csum_copy_err; goto csum_copy_err;
......
...@@ -363,7 +363,8 @@ int udpv6_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, ...@@ -363,7 +363,8 @@ int udpv6_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
* coverage checksum (UDP-Lite), do it before the copy. * coverage checksum (UDP-Lite), do it before the copy.
*/ */
if (copied < ulen || UDP_SKB_CB(skb)->partial_cov || peeking) { if (copied < ulen || peeking ||
(is_udplite && UDP_SKB_CB(skb)->partial_cov)) {
checksum_valid = !udp_lib_checksum_complete(skb); checksum_valid = !udp_lib_checksum_complete(skb);
if (!checksum_valid) if (!checksum_valid)
goto csum_copy_err; goto csum_copy_err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment