From: Neil Horman <nhorman@tuxdriver.com> Date: 2011-04-06 17:58:09
properly record sk_rxhash in ipv6 sockets
Noticed while working on another project that flows to sockets which I had open
on a test systems weren't getting steered properly when I had RFS enabled.
Looking more closely I found that:
1) The affected sockets were all ipv6
2) They weren't getting steered because sk->sk_rxhash was never set from the
incomming skbs on that socket.
This was occuring because there are several points in the IPv4 tcp and udp code
which save the rxhash value when a new connection is established. Those calls
to sock_rps_save_rxhash were never added to the corresponding ipv6 code paths.
This patch adds those calls. Tested by myself to properly enable RFS
functionalty on ipv6.
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
CC: "David S. Miller" <davem@davemloft.net>
CC: Alexey Kuznetsov <redacted>
CC: "Pekka Savola (ipv6)" <redacted>
CC: James Morris <jmorris@namei.org>
CC: Hideaki YOSHIFUJI <redacted>
CC: Patrick McHardy <redacted>
---
net/ipv6/tcp_ipv6.c | 4 +++-
net/ipv6/udp.c | 2 ++
2 files changed, 5 insertions(+), 1 deletions(-)
Problem is every packet received might have a different rxhash if
multiple senders are active.
This can hurt performance (cache misses on RFS table) on a DNS server
workload for example.
This is why we used on ipv4 :
if (inet_sk(sk)->inet_daddr)
sock_rps_save_rxhash(sk, skb->rxhash);
Only arm RFS on UDP if socket is bound to a given remote peer.
BTW you forgot Tom Herbert. (I added him in CC)
This is why we used on ipv4 :
if (inet_sk(sk)->inet_daddr)
sock_rps_save_rxhash(sk, skb->rxhash);
Only arm RFS on UDP if socket is bound to a given remote peer.
Agreed, Neil please make this change to your ipv6 code.
Thanks!
This is why we used on ipv4 :
if (inet_sk(sk)->inet_daddr)
sock_rps_save_rxhash(sk, skb->rxhash);
Only arm RFS on UDP if socket is bound to a given remote peer.
Agreed, Neil please make this change to your ipv6 code.
BTW, do you guys know if NFS is using RFS right now (if TCP transport is
used) ?
This is why we used on ipv4 :
if (inet_sk(sk)->inet_daddr)
sock_rps_save_rxhash(sk, skb->rxhash);
Only arm RFS on UDP if socket is bound to a given remote peer.
Agreed, Neil please make this change to your ipv6 code.
BTW, do you guys know if NFS is using RFS right now (if TCP transport is
used) ?
It ought to be. Are you specifically concerned that it might be
missing the rxhash setting calls because of the APIs it uses to
do socket I/O?
The SunRPC layer is a major user of tcp_read_sock(), for example.
But the packet processing will be done via the normal means,
therefore we'll hit tcp_v4_do_rcv() and therefore save the
rxhash.
This is why we used on ipv4 :
if (inet_sk(sk)->inet_daddr)
sock_rps_save_rxhash(sk, skb->rxhash);
Only arm RFS on UDP if socket is bound to a given remote peer.
Agreed, Neil please make this change to your ipv6 code.
BTW, do you guys know if NFS is using RFS right now (if TCP transport is
used) ?
Thats kind of a tricky question, are you referring to clients or servers? Both
should be able to use RFS as Dave notes, but since sockets in NFS clients tend to be per
mount, rather than per application (as RFS nominally expects when doing flow
steering), theres likely to be some conflict in where RFS decides to steer
packets for that NFS socket as different applications on different cpus make
use of the same socket.
Neil
This is why we used on ipv4 :
if (inet_sk(sk)->inet_daddr)
sock_rps_save_rxhash(sk, skb->rxhash);
Only arm RFS on UDP if socket is bound to a given remote peer.
Agreed, Neil please make this change to your ipv6 code.
BTW, do you guys know if NFS is using RFS right now (if TCP transport is
used) ?
It ought to be. Are you specifically concerned that it might be
missing the rxhash setting calls because of the APIs it uses to
do socket I/O?
The SunRPC layer is a major user of tcp_read_sock(), for example.
But the packet processing will be done via the normal means,
therefore we'll hit tcp_v4_do_rcv() and therefore save the
rxhash.
Hmm, are multiple tcp sessions used between NFS client and server (One
per cpu on client ?)
From: Eric Dumazet <hidden> Date: 2011-04-06 18:39:00
Le mercredi 06 avril 2011 à 14:33 -0400, Neil Horman a écrit :
Thats kind of a tricky question, are you referring to clients or servers? Both
should be able to use RFS as Dave notes, but since sockets in NFS clients tend to be per
mount, rather than per application (as RFS nominally expects when doing flow
steering), theres likely to be some conflict in where RFS decides to steer
packets for that NFS socket as different applications on different cpus make
use of the same socket.
Yes, maybe there are some updates to make NFS scale better with
multiqueue NICS [ or RPS/RFS ]
Problem is every packet received might have a different rxhash if
multiple senders are active.
This can hurt performance (cache misses on RFS table) on a DNS server
workload for example.
This is why we used on ipv4 :
if (inet_sk(sk)->inet_daddr)
sock_rps_save_rxhash(sk, skb->rxhash);
Ok, I can absolutely do that, I'll respin shortly. Just to make sure I
understand how to do this, the ipv6 equivalant of inet_daddr is
inet6_sk(sk)->daddr, correct? I ask because the above v4 equivalent is stored in
the sk_common struct, and I want to make sure I'm testing the right data.
Also, do we have a macro already to see if an ipv6 address is all zeros? I'm
not finding one, but I'd hate to re-invent the wheel if I'm just missing it.
Only arm RFS on UDP if socket is bound to a given remote peer.
BTW you forgot Tom Herbert. (I added him in CC)
Thanks, sorry Tom, Just took the output of get_maintainers.pl without checking
all the results.
Neil
This is why we used on ipv4 :
if (inet_sk(sk)->inet_daddr)
sock_rps_save_rxhash(sk, skb->rxhash);
Only arm RFS on UDP if socket is bound to a given remote peer.
Agreed, Neil please make this change to your ipv6 code.
BTW, do you guys know if NFS is using RFS right now (if TCP transport is
used) ?
It ought to be. Are you specifically concerned that it might be
missing the rxhash setting calls because of the APIs it uses to
do socket I/O?
The SunRPC layer is a major user of tcp_read_sock(), for example.
But the packet processing will be done via the normal means,
therefore we'll hit tcp_v4_do_rcv() and therefore save the
rxhash.
Hmm, are multiple tcp sessions used between NFS client and server (One
per cpu on client ?)
nope, its all nominally done per mount (i.e. all applications writing to a given
mount point will share the same socket).
Neil
From: Brian Haley <hidden> Date: 2011-04-06 19:04:13
On 04/06/2011 02:39 PM, Neil Horman wrote:
Also, do we have a macro already to see if an ipv6 address is all zeros? I'm
not finding one, but I'd hate to re-invent the wheel if I'm just missing it.
From: Neil Horman <nhorman@tuxdriver.com> Date: 2011-04-06 19:25:29
On Wed, Apr 06, 2011 at 02:53:11PM -0400, Brian Haley wrote:
On 04/06/2011 02:39 PM, Neil Horman wrote:
quoted
Also, do we have a macro already to see if an ipv6 address is all zeros? I'm
not finding one, but I'd hate to re-invent the wheel if I'm just missing it.
From: Neil Horman <nhorman@tuxdriver.com> Date: 2011-04-06 19:42:02
properly record sk_rxhash in ipv6 sockets (v2)
Noticed while working on another project that flows to sockets which I had open
on a test systems weren't getting steered properly when I had RFS enabled.
Looking more closely I found that:
1) The affected sockets were all ipv6
2) They weren't getting steered because sk->sk_rxhash was never set from the
incomming skbs on that socket.
This was occuring because there are several points in the IPv4 tcp and udp code
which save the rxhash value when a new connection is established. Those calls
to sock_rps_save_rxhash were never added to the corresponding ipv6 code paths.
This patch adds those calls. Tested by myself to properly enable RFS
functionalty on ipv6.
Change notes:
v2:
Filtered UDP to only arm RFS on bound sockets (Eric Dumazet)
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
CC: "David S. Miller" <davem@davemloft.net>
CC: Alexey Kuznetsov <redacted>
CC: "Pekka Savola (ipv6)" <redacted>
CC: James Morris <jmorris@namei.org>
CC: Hideaki YOSHIFUJI <redacted>
CC: Patrick McHardy <redacted>
CC: Tom Herbert <redacted>
---
net/ipv6/tcp_ipv6.c | 4 +++-
net/ipv6/udp.c | 3 +++
2 files changed, 6 insertions(+), 1 deletions(-)
properly record sk_rxhash in ipv6 sockets (v2)
Noticed while working on another project that flows to sockets which I had open
on a test systems weren't getting steered properly when I had RFS enabled.
Looking more closely I found that:
1) The affected sockets were all ipv6
2) They weren't getting steered because sk->sk_rxhash was never set from the
incomming skbs on that socket.
This was occuring because there are several points in the IPv4 tcp and udp code
which save the rxhash value when a new connection is established. Those calls
to sock_rps_save_rxhash were never added to the corresponding ipv6 code paths.
This patch adds those calls. Tested by myself to properly enable RFS
functionalty on ipv6.
Change notes:
v2:
Filtered UDP to only arm RFS on bound sockets (Eric Dumazet)
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Ok, I've decided to apply this to net-2.6
The current behavior even surprised me, I was pretty sure we had added
the hooks to both ipv4 and ipv6.
Thanks a lot Neil.
properly record sk_rxhash in ipv6 sockets (v2)
Noticed while working on another project that flows to sockets which I had open
on a test systems weren't getting steered properly when I had RFS enabled.
Looking more closely I found that:
1) The affected sockets were all ipv6
2) They weren't getting steered because sk->sk_rxhash was never set from the
incomming skbs on that socket.
This was occuring because there are several points in the IPv4 tcp and udp code
which save the rxhash value when a new connection is established. Those calls
to sock_rps_save_rxhash were never added to the corresponding ipv6 code paths.
This patch adds those calls. Tested by myself to properly enable RFS
functionalty on ipv6.
Change notes:
v2:
Filtered UDP to only arm RFS on bound sockets (Eric Dumazet)
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Ok, I've decided to apply this to net-2.6
The current behavior even surprised me, I was pretty sure we had added
the hooks to both ipv4 and ipv6.
Thanks a lot Neil.
Thanks Dave, I was kind of suprised too, but we definately weren't recording the
rxhash. FWIW It doesn't appear to be a regression. I can't find where in the
history we ever had the hooks. Perhaps at one point tcp and udp rcv paths were
common between ipv4 and 6 address families, and then we bifurcated without
replicating the sock_rps_save_rxhash calls?
Neil