summaryrefslogtreecommitdiff
path: root/include/net/rps.h
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2024-03-06 19:00:31 +0300
committerJakub Kicinski <kuba@kernel.org>2024-03-08 08:12:43 +0300
commitce7f49ab741591d83e33e56948bac2f12de6e14e (patch)
tree29b291f5ccbeb9324f98f48e352a84d311314f69 /include/net/rps.h
parent490a79faf95e705ba0ffd9ebf04a624b379e53c9 (diff)
downloadlinux-ce7f49ab741591d83e33e56948bac2f12de6e14e.tar.xz
net: move rps_sock_flow_table to net_hotdata
rps_sock_flow_table and rps_cpu_mask are used in fast path. Move them to net_hotdata for better cache locality. Signed-off-by: Eric Dumazet <edumazet@google.com> Acked-by: Soheil Hassas Yeganeh <soheil@google.com> Reviewed-by: David Ahern <dsahern@kernel.org> Link: https://lore.kernel.org/r/20240306160031.874438-19-edumazet@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include/net/rps.h')
-rw-r--r--include/net/rps.h8
1 files changed, 3 insertions, 5 deletions
diff --git a/include/net/rps.h b/include/net/rps.h
index 6081d817d245..7660243e905b 100644
--- a/include/net/rps.h
+++ b/include/net/rps.h
@@ -5,6 +5,7 @@
#include <linux/types.h>
#include <linux/static_key.h>
#include <net/sock.h>
+#include <net/hotdata.h>
#ifdef CONFIG_RPS
@@ -64,14 +65,11 @@ struct rps_sock_flow_table {
#define RPS_NO_CPU 0xffff
-extern u32 rps_cpu_mask;
-extern struct rps_sock_flow_table __rcu *rps_sock_flow_table;
-
static inline void rps_record_sock_flow(struct rps_sock_flow_table *table,
u32 hash)
{
unsigned int index = hash & table->mask;
- u32 val = hash & ~rps_cpu_mask;
+ u32 val = hash & ~net_hotdata.rps_cpu_mask;
/* We only give a hint, preemption can change CPU under us */
val |= raw_smp_processor_id();
@@ -93,7 +91,7 @@ static inline void sock_rps_record_flow_hash(__u32 hash)
if (!hash)
return;
rcu_read_lock();
- sock_flow_table = rcu_dereference(rps_sock_flow_table);
+ sock_flow_table = rcu_dereference(net_hotdata.rps_sock_flow_table);
if (sock_flow_table)
rps_record_sock_flow(sock_flow_table, hash);
rcu_read_unlock();