[PATCH net-next] udp: prefetch rmem_alloc in udp_queue_rcv_skb()

Subsystems: networking [general], the rest, user datagram protocol (udp)

STALE3403d

3 messages, 2 authors, 2017-06-21 · open the first message on its own page

[PATCH net-next] udp: prefetch rmem_alloc in udp_queue_rcv_skb()

From: Paolo Abeni <pabeni@redhat.com>
Date: 2017-06-21 08:49:30

On UDP packets processing, if the BH is the bottle-neck, it
always sees a cache miss while updating rmem_alloc; try to
avoid it prefetching the value as soon as we have the socket
available.

Performances under flood with multiple NIC rx queues used are
unaffected, but when a single NIC rx queue is in use, this
gives ~10% performance improvement.

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
 net/ipv4/udp.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index f3450f0..067a607 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1949,6 +1949,7 @@ static int udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
 		}
 	}
 
+	prefetch(&sk->sk_rmem_alloc);
 	if (rcu_access_pointer(sk->sk_filter) &&
 	    udp_lib_checksum_complete(skb))
 			goto csum_error;
-- 
2.9.4

Re: [PATCH net-next] udp: prefetch rmem_alloc in udp_queue_rcv_skb()

From: David Miller <davem@davemloft.net>
Date: 2017-06-21 16:20:49

From: Paolo Abeni <pabeni@redhat.com>
Date: Wed, 21 Jun 2017 10:24:40 +0200
On UDP packets processing, if the BH is the bottle-neck, it
always sees a cache miss while updating rmem_alloc; try to
avoid it prefetching the value as soon as we have the socket
available.

Performances under flood with multiple NIC rx queues used are
unaffected, but when a single NIC rx queue is in use, this
gives ~10% performance improvement.

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Applied, but what about ipv6?

Re: [PATCH net-next] udp: prefetch rmem_alloc in udp_queue_rcv_skb()

From: Paolo Abeni <pabeni@redhat.com>
Date: 2017-06-21 16:22:59

On Wed, 2017-06-21 at 11:41 -0400, David Miller wrote:
From: Paolo Abeni <pabeni@redhat.com>
Date: Wed, 21 Jun 2017 10:24:40 +0200
quoted
On UDP packets processing, if the BH is the bottle-neck, it
always sees a cache miss while updating rmem_alloc; try to
avoid it prefetching the value as soon as we have the socket
available.

Performances under flood with multiple NIC rx queues used are
unaffected, but when a single NIC rx queue is in use, this
gives ~10% performance improvement.

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Applied, but what about ipv6?
You are right, that was unintentionally left out. I'll do some tests
and send another patch for ipv6, too.

Thanks,

Paolo
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help