summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2025-06-30 12:35:39 +0300
committerJakub Kicinski <kuba@kernel.org>2025-07-03 00:22:02 +0300
commit83081337419cb692eca4ee475d936b1fdcfd49f6 (patch)
tree306d7b12294131e5db495b773f9eb5bbddb936cf /include
parent998642e999d23324c5dbf38149606d09cec2c377 (diff)
downloadlinux-83081337419cb692eca4ee475d936b1fdcfd49f6.tar.xz
tcp: move tcp_memory_allocated into net_aligned_data
____cacheline_aligned_in_smp attribute only makes sure to align a field to a cache line. It does not prevent the linker to use the remaining of the cache line for other variables, causing potential false sharing. Move tcp_memory_allocated into a dedicated cache line. Signed-off-by: Eric Dumazet <edumazet@google.com> Reviewed-by: Willem de Bruijn <willemb@google.com> Link: https://patch.msgid.link/20250630093540.3052835-4-edumazet@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include')
-rw-r--r--include/net/aligned_data.h3
-rw-r--r--include/net/tcp.h1
2 files changed, 3 insertions, 1 deletions
diff --git a/include/net/aligned_data.h b/include/net/aligned_data.h
index 5c7badf71f04..bedb4f86b0fe 100644
--- a/include/net/aligned_data.h
+++ b/include/net/aligned_data.h
@@ -11,6 +11,9 @@
*/
struct net_aligned_data {
atomic64_t net_cookie ____cacheline_aligned_in_smp;
+#if defined(CONFIG_INET)
+ atomic_long_t tcp_memory_allocated ____cacheline_aligned_in_smp;
+#endif
};
extern struct net_aligned_data net_aligned_data;
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 761c4a0ad386..bc08de49805c 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -267,7 +267,6 @@ extern long sysctl_tcp_mem[3];
#define TCP_RACK_STATIC_REO_WND 0x2 /* Use static RACK reo wnd */
#define TCP_RACK_NO_DUPTHRESH 0x4 /* Do not use DUPACK threshold in RACK */
-extern atomic_long_t tcp_memory_allocated;
DECLARE_PER_CPU(int, tcp_memory_per_cpu_fw_alloc);
extern struct percpu_counter tcp_sockets_allocated;