Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

udp: move udp_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.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/20250630093540.3052835-5-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Eric Dumazet and committed by
Jakub Kicinski
e3d48251 83081337

+7 -7
+1
include/net/aligned_data.h
··· 13 13 atomic64_t net_cookie ____cacheline_aligned_in_smp; 14 14 #if defined(CONFIG_INET) 15 15 atomic_long_t tcp_memory_allocated ____cacheline_aligned_in_smp; 16 + atomic_long_t udp_memory_allocated ____cacheline_aligned_in_smp; 16 17 #endif 17 18 }; 18 19
-1
include/net/udp.h
··· 205 205 206 206 extern struct proto udp_prot; 207 207 208 - extern atomic_long_t udp_memory_allocated; 209 208 DECLARE_PER_CPU(int, udp_memory_per_cpu_fw_alloc); 210 209 211 210 /* sysctl variables for udp */
+1 -3
net/ipv4/udp.c
··· 127 127 long sysctl_udp_mem[3] __read_mostly; 128 128 EXPORT_IPV6_MOD(sysctl_udp_mem); 129 129 130 - atomic_long_t udp_memory_allocated ____cacheline_aligned_in_smp; 131 - EXPORT_IPV6_MOD(udp_memory_allocated); 132 130 DEFINE_PER_CPU(int, udp_memory_per_cpu_fw_alloc); 133 131 EXPORT_PER_CPU_SYMBOL_GPL(udp_memory_per_cpu_fw_alloc); 134 132 ··· 3233 3235 #ifdef CONFIG_BPF_SYSCALL 3234 3236 .psock_update_sk_prot = udp_bpf_update_proto, 3235 3237 #endif 3236 - .memory_allocated = &udp_memory_allocated, 3238 + .memory_allocated = &net_aligned_data.udp_memory_allocated, 3237 3239 .per_cpu_fw_alloc = &udp_memory_per_cpu_fw_alloc, 3238 3240 3239 3241 .sysctl_mem = sysctl_udp_mem,
+1
net/ipv4/udp_impl.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0 */ 2 2 #ifndef _UDP4_IMPL_H 3 3 #define _UDP4_IMPL_H 4 + #include <net/aligned_data.h> 4 5 #include <net/udp.h> 5 6 #include <net/udplite.h> 6 7 #include <net/protocol.h>
+1 -1
net/ipv4/udplite.c
··· 60 60 .rehash = udp_v4_rehash, 61 61 .get_port = udp_v4_get_port, 62 62 63 - .memory_allocated = &udp_memory_allocated, 63 + .memory_allocated = &net_aligned_data.udp_memory_allocated, 64 64 .per_cpu_fw_alloc = &udp_memory_per_cpu_fw_alloc, 65 65 66 66 .sysctl_mem = sysctl_udp_mem,
+1 -1
net/ipv6/udp.c
··· 1925 1925 .psock_update_sk_prot = udp_bpf_update_proto, 1926 1926 #endif 1927 1927 1928 - .memory_allocated = &udp_memory_allocated, 1928 + .memory_allocated = &net_aligned_data.udp_memory_allocated, 1929 1929 .per_cpu_fw_alloc = &udp_memory_per_cpu_fw_alloc, 1930 1930 1931 1931 .sysctl_mem = sysctl_udp_mem,
+1
net/ipv6/udp_impl.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0 */ 2 2 #ifndef _UDP6_IMPL_H 3 3 #define _UDP6_IMPL_H 4 + #include <net/aligned_data.h> 4 5 #include <net/udp.h> 5 6 #include <net/udplite.h> 6 7 #include <net/protocol.h>
+1 -1
net/ipv6/udplite.c
··· 59 59 .rehash = udp_v6_rehash, 60 60 .get_port = udp_v6_get_port, 61 61 62 - .memory_allocated = &udp_memory_allocated, 62 + .memory_allocated = &net_aligned_data.udp_memory_allocated, 63 63 .per_cpu_fw_alloc = &udp_memory_per_cpu_fw_alloc, 64 64 65 65 .sysctl_mem = sysctl_udp_mem,