All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: "David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>
Cc: netdev <netdev@vger.kernel.org>,
	Eric Dumazet <edumazet@google.com>,
	Eric Dumazet <eric.dumazet@gmail.com>,
	Soheil Hassas Yeganeh <soheil@google.com>,
	Neal Cardwell <ncardwell@google.com>
Subject: [PATCH v2 net-next 04/10] net: avoid dirtying sk->sk_rx_queue_mapping
Date: Mon, 25 Oct 2021 09:48:19 -0700	[thread overview]
Message-ID: <20211025164825.259415-5-eric.dumazet@gmail.com> (raw)
In-Reply-To: <20211025164825.259415-1-eric.dumazet@gmail.com>

From: Eric Dumazet <edumazet@google.com>

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>
---
 include/net/sock.h | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/include/net/sock.h b/include/net/sock.h
index 99c4194cb61add848e3a35db0f952c4193f5ea1f..b4d3744b188ad869b4ec55f78e04236b710898de 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
 }
-- 
2.33.0.1079.g6e70778dc9-goog


  parent reply	other threads:[~2021-10-25 16:48 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-25 16:48 [PATCH v2 net-next 00/10] tcp: receive path optimizations Eric Dumazet
2021-10-25 16:48 ` [PATCH v2 net-next 01/10] tcp: move inet->rx_dst_ifindex to sk->sk_rx_dst_ifindex Eric Dumazet
2021-10-25 16:48 ` [PATCH v2 net-next 02/10] ipv6: move inet6_sk(sk)->rx_dst_cookie to sk->sk_rx_dst_cookie Eric Dumazet
2021-10-25 16:48 ` [PATCH v2 net-next 03/10] net: avoid dirtying sk->sk_napi_id Eric Dumazet
2021-10-25 16:48 ` Eric Dumazet [this message]
2021-10-25 16:48 ` [PATCH v2 net-next 05/10] net: annotate accesses to sk->sk_rx_queue_mapping Eric Dumazet
2021-10-25 16:48 ` [PATCH v2 net-next 06/10] ipv6: annotate data races around np->min_hopcount Eric Dumazet
2021-10-25 16:48 ` [PATCH v2 net-next 07/10] ipv6: guard IPV6_MINHOPCOUNT with a static key Eric Dumazet
2021-10-25 16:48 ` [PATCH v2 net-next 08/10] ipv4: annotate data races arount inet->min_ttl Eric Dumazet
2021-10-25 16:48 ` [PATCH v2 net-next 09/10] ipv4: guard IP_MINTTL with a static key Eric Dumazet
2021-10-25 16:48 ` [PATCH v2 net-next 10/10] ipv6/tcp: small drop monitor changes Eric Dumazet
2021-10-26  2:20 ` [PATCH v2 net-next 00/10] tcp: receive path optimizations patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211025164825.259415-5-eric.dumazet@gmail.com \
    --to=eric.dumazet@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=ncardwell@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=soheil@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.