Message ID | 1270559096.2081.35.camel@edumazet-laptop |
---|---|
State | RFC, archived |
Delegated to: | David Miller |
Headers | show |
On Tue, Apr 6, 2010 at 9:04 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote: > > 1) The need to add "rps_flow_entries=xxx" at boot time is problematic. > Maybe we can allow it being dynamic (and use vmalloc() instead of > alloc_large_system_hash()) Is flex_array better than vmalloc()?
> > Running on a preprod machine here, seems fine. > > Some questions : > > 1) The need to add "rps_flow_entries=xxx" at boot time is problematic. > Maybe we can allow it being dynamic (and use vmalloc() instead of > alloc_large_system_hash()) > Okay, could be a sysctl with vmalloc. > 2) inet_rps_save_rxhash(sk, skb->rxhash); > > It should have a check to make sure some part of the stack doesnt feed > many different rxhash for a given socket (Make sure we dont pollute flow > table with pseudo random values) > If packets for a connection are always received on the same device, is it reasonable to assume the rxhash is constant for that connection? I suppose it's possible that packets for a same sockets are being constantly received on two different devices that are giving different rxhashes. This would already be bad in that OOO is probably happening anyway. I don't know if thrashing the sock_flow_table is going to aggravate this scenario much. Are there any other degenerative cases you're worried about? > 3) UDP connected sockets dont benefit of RFS currently > (Not sure many apps use connected UDP sockets, I do have some of them > in house) > Makes sense to support that. > I am trying following code for IPV4 only : > > diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c > index 7af756d..5c2d37a 100644 > --- a/net/ipv4/udp.c > +++ b/net/ipv4/udp.c > @@ -1216,6 +1216,7 @@ int udp_disconnect(struct sock *sk, int flags) > sk->sk_state = TCP_CLOSE; > inet->inet_daddr = 0; > inet->inet_dport = 0; > + inet_rps_save_rxhash(sk, 0); > sk->sk_bound_dev_if = 0; > if (!(sk->sk_userlocks & SOCK_BINDADDR_LOCK)) > inet_reset_saddr(sk); > @@ -1257,8 +1258,12 @@ EXPORT_SYMBOL(udp_lib_unhash); > > static int __udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) > { > - int rc = sock_queue_rcv_skb(sk, skb); > + int rc; > + > + if (inet_sk(sk)->inet_daddr) > + inet_rps_save_rxhash(sk, skb->rxhash); > > + rc = sock_queue_rcv_skb(sk, skb); > if (rc < 0) { > int is_udplite = IS_UDPLITE(sk); > > > > -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Le mardi 06 avril 2010 à 07:25 -0700, Tom Herbert a écrit : > > 2) inet_rps_save_rxhash(sk, skb->rxhash); > > > > It should have a check to make sure some part of the stack doesnt feed > > many different rxhash for a given socket (Make sure we dont pollute flow > > table with pseudo random values) > > > If packets for a connection are always received on the same device, is > it reasonable to assume the rxhash is constant for that connection? > > I suppose it's possible that packets for a same sockets are being > constantly received on two different devices that are giving different > rxhashes. This would already be bad in that OOO is probably happening > anyway. I don't know if thrashing the sock_flow_table is going to > aggravate this scenario much. > > Are there any other degenerative cases you're worried about? No, I was only considering this mostly as a debugging aid, before RPS is stable, because mismatches could be unnoticed and performance not optimal. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 7af756d..5c2d37a 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c @@ -1216,6 +1216,7 @@ int udp_disconnect(struct sock *sk, int flags) sk->sk_state = TCP_CLOSE; inet->inet_daddr = 0; inet->inet_dport = 0; + inet_rps_save_rxhash(sk, 0); sk->sk_bound_dev_if = 0; if (!(sk->sk_userlocks & SOCK_BINDADDR_LOCK)) inet_reset_saddr(sk); @@ -1257,8 +1258,12 @@ EXPORT_SYMBOL(udp_lib_unhash); static int __udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) { - int rc = sock_queue_rcv_skb(sk, skb); + int rc; + + if (inet_sk(sk)->inet_daddr) + inet_rps_save_rxhash(sk, skb->rxhash); + rc = sock_queue_rcv_skb(sk, skb); if (rc < 0) { int is_udplite = IS_UDPLITE(sk);