diff options
author | Eric Dumazet <edumazet@google.com> | 2021-10-25 09:48:19 -0700 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2021-10-25 18:02:13 -0700 |
commit | 342159ee394d103db4bea1b01f932c50e66be163 (patch) | |
tree | c4105dc13c4a7fe429d6f4eca49033e54dd9fee8 /include/net/sock.h | |
parent | 2b13af8ade38ef3afe48d60c518c64010cfa8b0d (diff) |
net: avoid dirtying sk->sk_rx_queue_mapping
sk_rx_queue_mapping is located in a cache line that should be kept read mostly.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include/net/sock.h')
-rw-r--r-- | include/net/sock.h | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/include/net/sock.h b/include/net/sock.h index 99c4194cb61a..b4d3744b188a 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -1916,10 +1916,8 @@ static inline void sk_rx_queue_set(struct sock *sk, const struct sk_buff *skb) if (skb_rx_queue_recorded(skb)) { u16 rx_queue = skb_get_rx_queue(skb); - if (WARN_ON_ONCE(rx_queue == NO_QUEUE_MAPPING)) - return; - - sk->sk_rx_queue_mapping = rx_queue; + if (unlikely(READ_ONCE(sk->sk_rx_queue_mapping) != rx_queue)) + WRITE_ONCE(sk->sk_rx_queue_mapping, rx_queue); } #endif } |