mirror of
https://github.com/lkl/linux.git
synced 2025-12-19 08:03:01 +09:00
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>
This commit is contained in:
committed by
David S. Miller
parent
a5ef058dc4
commit
8a3854c7b8
@@ -174,6 +174,15 @@ INDIRECT_CALLABLE_DECLARE(int udpv6_rcv(struct sk_buff *));
|
||||
struct sk_buff *__udp_gso_segment(struct sk_buff *gso_skb,
|
||||
netdev_features_t features, bool is_ipv6);
|
||||
|
||||
static inline void udp_lib_init_sock(struct sock *sk)
|
||||
{
|
||||
struct udp_sock *up = udp_sk(sk);
|
||||
|
||||
skb_queue_head_init(&up->reader_queue);
|
||||
up->forward_threshold = sk->sk_rcvbuf >> 2;
|
||||
set_bit(SOCK_CUSTOM_SOCKOPT, &sk->sk_socket->flags);
|
||||
}
|
||||
|
||||
/* hash routines shared between UDPv4/6 and UDP-Litev4/6 */
|
||||
static inline int udp_lib_hash(struct sock *sk)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user