summaryrefslogtreecommitdiff
path: root/include/net
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2024-04-29 16:40:25 +0300
committerJakub Kicinski <kuba@kernel.org>2024-05-01 04:46:52 +0300
commitc204fef97ee62ca3310f43d12bbda4eb10266c7c (patch)
tree6cc12ade57310fb99b3a64b72516bee33488c1b3 /include/net
parentf3d93817fba30a8d3508fa990405039c0820dca3 (diff)
downloadlinux-c204fef97ee62ca3310f43d12bbda4eb10266c7c.tar.xz
net: move sysctl_mem_pcpu_rsv to net_hotdata
sysctl_mem_pcpu_rsv is used in TCP fast path, move it to net_hodata for better cache locality. Signed-off-by: Eric Dumazet <edumazet@google.com> Reviewed-by: David Ahern <dsahern@kernel.org> Link: https://lore.kernel.org/r/20240429134025.1233626-6-edumazet@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/hotdata.h1
-rw-r--r--include/net/proto_memory.h6
2 files changed, 4 insertions, 3 deletions
diff --git a/include/net/hotdata.h b/include/net/hotdata.h
index 290499f72e18..30e9570beb2a 100644
--- a/include/net/hotdata.h
+++ b/include/net/hotdata.h
@@ -40,6 +40,7 @@ struct net_hotdata {
int dev_rx_weight;
int sysctl_max_skb_frags;
int sysctl_skb_defer_max;
+ int sysctl_mem_pcpu_rsv;
};
#define inet_ehash_secret net_hotdata.tcp_protocol.secret
diff --git a/include/net/proto_memory.h b/include/net/proto_memory.h
index 41404d4bb6f0..a6ab2f4f5e28 100644
--- a/include/net/proto_memory.h
+++ b/include/net/proto_memory.h
@@ -3,10 +3,10 @@
#define _PROTO_MEMORY_H
#include <net/sock.h>
+#include <net/hotdata.h>
/* 1 MB per cpu, in page units */
#define SK_MEMORY_PCPU_RESERVE (1 << (20 - PAGE_SHIFT))
-extern int sysctl_mem_pcpu_rsv;
static inline bool sk_has_memory_pressure(const struct sock *sk)
{
@@ -65,7 +65,7 @@ sk_memory_allocated_add(const struct sock *sk, int val)
val = this_cpu_add_return(*proto->per_cpu_fw_alloc, val);
- if (unlikely(val >= READ_ONCE(sysctl_mem_pcpu_rsv)))
+ if (unlikely(val >= READ_ONCE(net_hotdata.sysctl_mem_pcpu_rsv)))
proto_memory_pcpu_drain(proto);
}
@@ -76,7 +76,7 @@ sk_memory_allocated_sub(const struct sock *sk, int val)
val = this_cpu_sub_return(*proto->per_cpu_fw_alloc, val);
- if (unlikely(val <= -READ_ONCE(sysctl_mem_pcpu_rsv)))
+ if (unlikely(val <= -READ_ONCE(net_hotdata.sysctl_mem_pcpu_rsv)))
proto_memory_pcpu_drain(proto);
}