]> git.karo-electronics.de Git - linux-beck.git/commitdiff
udp: avoid one cache line miss in recvmsg()
authorEric Dumazet <edumazet@google.com>
Sat, 19 Nov 2016 01:18:03 +0000 (17:18 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 21 Nov 2016 16:26:59 +0000 (11:26 -0500)
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: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/udp.c
net/ipv6/udp.c

index e1fc0116e8d59d8185670c6e55d1219bde55610d..b949770fdc08398a10f3974505a50b2b4f4b2cf3 100644 (file)
@@ -1389,7 +1389,8 @@ try_again:
         * 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);
                if (!checksum_valid)
                        goto csum_copy_err;
index 4f99417d9b401f2a65c7828e7d6b86d1d6161794..8fd4d89380b86c8630f7fd27ce4e9958497a2b89 100644 (file)
@@ -363,7 +363,8 @@ try_again:
         * 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);
                if (!checksum_valid)
                        goto csum_copy_err;