aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/linux/udp.h
diff options
context:
space:
mode:
authorPaolo Abeni <pabeni@redhat.com>2022-10-20 19:48:52 +0200
committerDavid S. Miller <davem@davemloft.net>2022-10-24 10:52:50 +0100
commit8a3854c7b8e4532063b14bed34115079b7d0cb36 (patch)
treecd84d6b901d6d1e14185481909982e4f267cd512 /include/linux/udp.h
parentnet: introduce and use custom sockopt socket flag (diff)
downloadwireguard-linux-8a3854c7b8e4532063b14bed34115079b7d0cb36.tar.xz
wireguard-linux-8a3854c7b8e4532063b14bed34115079b7d0cb36.zip
udp: track the forward memory release threshold in an hot cacheline
When the receiver process and the BH runs on different cores, udp_rmem_release() experience a cache miss while accessing sk_rcvbuf, as the latter shares the same cacheline with sk_forward_alloc, written by the BH. With this patch, UDP tracks the rcvbuf value and its update via custom SOL_SOCKET socket options, and copies the forward memory threshold value used by udp_rmem_release() in a different cacheline, already accessed by the above function and uncontended. Since the UDP socket init operation grown a bit, factor out the common code between v4 and v6 in a shared helper. Overall the above give a 10% peek throughput increase under UDP flood. Signed-off-by: Paolo Abeni <pabeni@redhat.com> Reviewed-by: Eric Dumazet <edumazet@google.com> Acked-by: Kuniyuki Iwashima <kuniyu@amazon.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/udp.h')
-rw-r--r--include/linux/udp.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/udp.h b/include/linux/udp.h
index e96da4157d04..5cdba00a904a 100644
--- a/include/linux/udp.h
+++ b/include/linux/udp.h
@@ -87,6 +87,9 @@ struct udp_sock {
/* This field is dirtied by udp_recvmsg() */
int forward_deficit;
+
+ /* This fields follows rcvbuf value, and is touched by udp_recvmsg */
+ int forward_threshold;
};
#define UDP_MAX_SEGMENTS (1 << 6UL)