aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/dev.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2023-06-07 10:09:05 +0100
committerDavid S. Miller <davem@davemloft.net>2023-06-07 10:09:05 +0100
commite3144ff52f7d2c884eef352cec9b9ff9acd2eb2f (patch)
treea5898632fd2ce3dd1f7dfca691a0a1f6dfdf1231 /net/core/dev.c
parentMerge tag 'for-net-2023-06-05' of git://git.kernel.org/pub/scm/linux/kernel/g... (diff)
parentrfs: annotate lockless accesses to RFS sock flow table (diff)
downloadlinux-e3144ff52f7d2c884eef352cec9b9ff9acd2eb2f.tar.gz
linux-e3144ff52f7d2c884eef352cec9b9ff9acd2eb2f.zip
Merge branch 'rfs-lockless-annotate'
Eric Dumazet says: ==================== rfs: annotate lockless accesses rfs runs without locks held, so we should annotate read and writes to shared variables. It should prevent compilers forcing writes in the following situation: if (var != val) var = val; A compiler could indeed simply avoid the conditional: var = val; This matters if var is shared between many cpus. v2: aligns one closing bracket (Simon) adds Fixes: tags (Jakub) ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/dev.c')
-rw-r--r--net/core/dev.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index b3c13e041935..1495f8aff288 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4471,8 +4471,10 @@ static int get_rps_cpu(struct net_device *dev, struct sk_buff *skb,
u32 next_cpu;
u32 ident;
- /* First check into global flow table if there is a match */
- ident = sock_flow_table->ents[hash & sock_flow_table->mask];
+ /* First check into global flow table if there is a match.
+ * This READ_ONCE() pairs with WRITE_ONCE() from rps_record_sock_flow().
+ */
+ ident = READ_ONCE(sock_flow_table->ents[hash & sock_flow_table->mask]);
if ((ident ^ hash) & ~rps_cpu_mask)
goto try_rps;