]> git.baikalelectronics.ru Git - kernel.git/commit
sock: avoid dirtying incoming_cpu if not needed
authorPaolo Abeni <pabeni@redhat.com>
Wed, 21 Jun 2017 09:45:31 +0000 (11:45 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 21 Jun 2017 15:43:01 +0000 (11:43 -0400)
commit1996b49e5ad9c221266f6f25009dc354ec08c786
tree0e7db516c60cf9e2b9c306be6b18fc0f50099a2c
parentf8c734b3164f3de62749d6784f5f430d71d8422e
sock: avoid dirtying incoming_cpu if not needed

for connected socket, the incoming_cpu field in the sock struct
is not going to change frequently, but we are setting it
unconditionally for each packet.

Since sk_incoming_cpu and sk_flags share the same cacheline,
and the latter is access by udp_recvmsg(), this cause a cache
miss for each packet for UDP connected socket.

With this patch, we set the incoming cpu field only when the
ingress cpu really changes.

This gives a small but measurable performance improvement for
connected UDP socket.

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/sock.h