aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2025-09-16 16:09:50 +0000
committerPaolo Abeni <pabeni@redhat.com>2025-09-18 10:17:10 +0200
commit3cd04c8f4afed71a48edef0db5255afc249c2feb (patch)
tree2554308232765f8599feabb359b9de7cc0e1f9f6 /include
parentudp: add udp_drops_inc() helper (diff)
downloadlinux-3cd04c8f4afed71a48edef0db5255afc249c2feb.tar.gz
linux-3cd04c8f4afed71a48edef0db5255afc249c2feb.zip
udp: make busylock per socket
While having all spinlocks packed into an array was a space saver, this also caused NUMA imbalance and hash collisions. UDPv6 socket size becomes 1600 after this patch. Signed-off-by: Eric Dumazet <edumazet@google.com> Reviewed-by: Willem de Bruijn <willemb@google.com> Reviewed-by: David Ahern <dsahern@kernel.org> Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com> Link: https://patch.msgid.link/20250916160951.541279-10-edumazet@google.com Reviewed-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/udp.h1
-rw-r--r--include/net/udp.h1
2 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/udp.h b/include/linux/udp.h
index 6ed008ab1665..e554890c4415 100644
--- a/include/linux/udp.h
+++ b/include/linux/udp.h
@@ -109,6 +109,7 @@ struct udp_sock {
*/
struct hlist_node tunnel_list;
struct numa_drop_counters drop_counters;
+ spinlock_t busylock ____cacheline_aligned_in_smp;
};
#define udp_test_bit(nr, sk) \
diff --git a/include/net/udp.h b/include/net/udp.h
index a08822e294b0..eecd64097f91 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -289,6 +289,7 @@ static inline void udp_lib_init_sock(struct sock *sk)
struct udp_sock *up = udp_sk(sk);
sk->sk_drop_counters = &up->drop_counters;
+ spin_lock_init(&up->busylock);
skb_queue_head_init(&up->reader_queue);
INIT_HLIST_NODE(&up->tunnel_list);
up->forward_threshold = sk->sk_rcvbuf >> 2;