netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] udp/v6: prefetch rmem_alloc in udp6_queue_rcv_skb()
@ 2017-06-22 13:01 Paolo Abeni
  2017-06-22 17:44 ` David Miller
  2017-06-22 20:49 ` Jesper Dangaard Brouer
  0 siblings, 2 replies; 4+ messages in thread
From: Paolo Abeni @ 2017-06-22 13:01 UTC (permalink / raw)
  To: netdev; +Cc: David S. Miller

very similar to commit dd99e425be23 ("udp: prefetch
rmem_alloc in udp_queue_rcv_skb()"), this allows saving a cache
miss when the BH is bottle-neck for UDP over ipv6 packet
processing, e.g. for small packets when a single RX NIC ingress
queue is in use.

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

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
 net/ipv6/udp.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 2b33847..d1d7288 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -630,6 +630,7 @@ static int udpv6_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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] udp/v6: prefetch rmem_alloc in udp6_queue_rcv_skb()
  2017-06-22 13:01 [PATCH net-next] udp/v6: prefetch rmem_alloc in udp6_queue_rcv_skb() Paolo Abeni
@ 2017-06-22 17:44 ` David Miller
  2017-06-22 17:59   ` Paolo Abeni
  2017-06-22 20:49 ` Jesper Dangaard Brouer
  1 sibling, 1 reply; 4+ messages in thread
From: David Miller @ 2017-06-22 17:44 UTC (permalink / raw)
  To: pabeni; +Cc: netdev

From: Paolo Abeni <pabeni@redhat.com>
Date: Thu, 22 Jun 2017 15:01:22 +0200

> very similar to commit dd99e425be23 ("udp: prefetch
> rmem_alloc in udp_queue_rcv_skb()"), this allows saving a cache
> miss when the BH is bottle-neck for UDP over ipv6 packet
> processing, e.g. for small packets when a single RX NIC ingress
> queue is in use.
> 
> Performances under flood when multiple NIC RX queues used are
> unaffected, but when a single NIC rx queue is in use, this
> gives ~8% performance improvement.
> 
> Signed-off-by: Paolo Abeni <pabeni@redhat.com>

Applied but please look into that DNS lookup regression which was
reported today.

Thank you.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] udp/v6: prefetch rmem_alloc in udp6_queue_rcv_skb()
  2017-06-22 17:44 ` David Miller
@ 2017-06-22 17:59   ` Paolo Abeni
  0 siblings, 0 replies; 4+ messages in thread
From: Paolo Abeni @ 2017-06-22 17:59 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

On Thu, 2017-06-22 at 13:44 -0400, David Miller wrote:
> From: Paolo Abeni <pabeni@redhat.com>
> Date: Thu, 22 Jun 2017 15:01:22 +0200
> 
> > very similar to commit dd99e425be23 ("udp: prefetch
> > rmem_alloc in udp_queue_rcv_skb()"), this allows saving a cache
> > miss when the BH is bottle-neck for UDP over ipv6 packet
> > processing, e.g. for small packets when a single RX NIC ingress
> > queue is in use.
> > 
> > Performances under flood when multiple NIC RX queues used are
> > unaffected, but when a single NIC rx queue is in use, this
> > gives ~8% performance improvement.
> > 
> > Signed-off-by: Paolo Abeni <pabeni@redhat.com>
> 
> Applied but please look into that DNS lookup regression which was
> reported today.

Sure! I'm on it right now.

Cheers,

Paolo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] udp/v6: prefetch rmem_alloc in udp6_queue_rcv_skb()
  2017-06-22 13:01 [PATCH net-next] udp/v6: prefetch rmem_alloc in udp6_queue_rcv_skb() Paolo Abeni
  2017-06-22 17:44 ` David Miller
@ 2017-06-22 20:49 ` Jesper Dangaard Brouer
  1 sibling, 0 replies; 4+ messages in thread
From: Jesper Dangaard Brouer @ 2017-06-22 20:49 UTC (permalink / raw)
  To: Paolo Abeni; +Cc: brouer, netdev, David S. Miller

On Thu, 22 Jun 2017 15:01:22 +0200
Paolo Abeni <pabeni@redhat.com> wrote:

> very similar to commit dd99e425be23 ("udp: prefetch
> rmem_alloc in udp_queue_rcv_skb()"), this allows saving a cache
> miss when the BH is bottle-neck for UDP over ipv6 packet
> processing, e.g. for small packets when a single RX NIC ingress
> queue is in use.
> 
> Performances under flood when multiple NIC RX queues used are
> unaffected, but when a single NIC rx queue is in use, this
> gives ~8% performance improvement.
> 
> Signed-off-by: Paolo Abeni <pabeni@redhat.com>

Testing IPv4 UDP on top of this patch, with ip_early_demux enabled.
I'm impressed, we can now to almost 3 Mpps UDP (across two CPUs) :-)))
Last time I tested on this machine it was around 2.3Mpps.

Good work Paolo! :-)

[jbrouer@skylake src]$ sysctl net/ipv4/ip_early_demux=1
net.ipv4.ip_early_demux = 1
[jbrouer@skylake src]$ 
[jbrouer@skylake src]$ sudo taskset -c 2 ./udp_sink --port 9 --count $((10**6)) --repeat 1000 --recvmsg --connect
          	run      count   	ns/pkt	pps		cycles	payload
recvmsg   	run:  0	 1000000	341.62	2927192.65	1369	18	 demux:1 c:1
recvmsg   	run:  1	 1000000	350.81	2850569.36	1406	18	 demux:1 c:1
recvmsg   	run:  2	 1000000	352.18	2839478.74	1411	18	 demux:1 c:1
recvmsg   	run:  3	 1000000	341.43	2928871.10	1368	18	 demux:1 c:1
recvmsg   	run:  4	 1000000	350.65	2851810.35	1405	18	 demux:1 c:1
recvmsg   	run:  5	 1000000	350.91	2849751.29	1406	18	 demux:1 c:1
recvmsg   	run:  6	 1000000	342.68	2918138.00	1373	18	 demux:1 c:1
recvmsg   	run:  7	 1000000	351.37	2845969.40	1408	18	 demux:1 c:1
recvmsg   	run:  8	 1000000	351.07	2848452.09	1407	18	 demux:1 c:1

https://github.com/netoptimizer/network-testing/blob/master/src/udp_sink.c

-- 
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Principal Kernel Engineer at Red Hat
  LinkedIn: http://www.linkedin.com/in/brouer

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-06-22 20:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-22 13:01 [PATCH net-next] udp/v6: prefetch rmem_alloc in udp6_queue_rcv_skb() Paolo Abeni
2017-06-22 17:44 ` David Miller
2017-06-22 17:59   ` Paolo Abeni
2017-06-22 20:49 ` Jesper Dangaard Brouer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).