* [PATCH net-next] tcp: fix RFS vs lockless listeners
@ 2015-10-08 18:16 Eric Dumazet
2015-10-08 21:11 ` Tom Herbert
2015-10-11 12:33 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Eric Dumazet @ 2015-10-08 18:16 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Willem de Bruijn, Tom Herbert
From: Eric Dumazet <edumazet@google.com>
Before recent TCP listener patches, we were updating listener
sk->sk_rxhash before the cloning of master socket.
children sk_rxhash was therefore correct after the normal 3WHS.
But with lockless listener, we no longer dirty/change listener sk_rxhash
as it would be racy.
We need to correctly update the child sk_rxhash, otherwise first data
packet wont hit correct cpu if RFS is used.
Fixes: 079096f103fa ("tcp/dccp: install syn_recv requests into ehash table")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Willem de Bruijn <willemb@google.com>
Cc: Tom Herbert <tom@herbertland.com>
---
net/ipv4/syncookies.c | 1 +
net/ipv4/tcp_minisocks.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c
index 8113c30ccf96..2dbb11331f6c 100644
--- a/net/ipv4/syncookies.c
+++ b/net/ipv4/syncookies.c
@@ -225,6 +225,7 @@ struct sock *tcp_get_cookie_sock(struct sock *sk, struct sk_buff *skb,
child = icsk->icsk_af_ops->syn_recv_sock(sk, skb, req, dst);
if (child) {
atomic_set(&req->rsk_refcnt, 1);
+ sock_rps_save_rxhash(child, skb);
inet_csk_reqsk_queue_add(sk, req, child);
} else {
reqsk_free(req);
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
index 9adf1e2c3170..1079e6ad77fe 100644
--- a/net/ipv4/tcp_minisocks.c
+++ b/net/ipv4/tcp_minisocks.c
@@ -768,6 +768,7 @@ struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb,
if (!child)
goto listen_overflow;
+ sock_rps_save_rxhash(child, skb);
tcp_synack_rtt_meas(child, req);
inet_csk_reqsk_queue_drop(sk, req);
inet_csk_reqsk_queue_add(sk, req, child);
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] tcp: fix RFS vs lockless listeners
2015-10-08 18:16 [PATCH net-next] tcp: fix RFS vs lockless listeners Eric Dumazet
@ 2015-10-08 21:11 ` Tom Herbert
2015-10-11 12:33 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Tom Herbert @ 2015-10-08 21:11 UTC (permalink / raw)
To: Eric Dumazet; +Cc: David Miller, netdev, Willem de Bruijn
On Thu, Oct 8, 2015 at 11:16 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> From: Eric Dumazet <edumazet@google.com>
>
> Before recent TCP listener patches, we were updating listener
> sk->sk_rxhash before the cloning of master socket.
>
> children sk_rxhash was therefore correct after the normal 3WHS.
>
> But with lockless listener, we no longer dirty/change listener sk_rxhash
> as it would be racy.
>
> We need to correctly update the child sk_rxhash, otherwise first data
> packet wont hit correct cpu if RFS is used.
>
> Fixes: 079096f103fa ("tcp/dccp: install syn_recv requests into ehash table")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Reported-by: Willem de Bruijn <willemb@google.com>
> Cc: Tom Herbert <tom@herbertland.com>
> ---
> net/ipv4/syncookies.c | 1 +
> net/ipv4/tcp_minisocks.c | 1 +
> 2 files changed, 2 insertions(+)
>
> diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c
> index 8113c30ccf96..2dbb11331f6c 100644
> --- a/net/ipv4/syncookies.c
> +++ b/net/ipv4/syncookies.c
> @@ -225,6 +225,7 @@ struct sock *tcp_get_cookie_sock(struct sock *sk, struct sk_buff *skb,
> child = icsk->icsk_af_ops->syn_recv_sock(sk, skb, req, dst);
> if (child) {
> atomic_set(&req->rsk_refcnt, 1);
> + sock_rps_save_rxhash(child, skb);
> inet_csk_reqsk_queue_add(sk, req, child);
> } else {
> reqsk_free(req);
> diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
> index 9adf1e2c3170..1079e6ad77fe 100644
> --- a/net/ipv4/tcp_minisocks.c
> +++ b/net/ipv4/tcp_minisocks.c
> @@ -768,6 +768,7 @@ struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb,
> if (!child)
> goto listen_overflow;
>
> + sock_rps_save_rxhash(child, skb);
> tcp_synack_rtt_meas(child, req);
> inet_csk_reqsk_queue_drop(sk, req);
> inet_csk_reqsk_queue_add(sk, req, child);
>
>
Acked-by: Tom Herbert <tom@herbertland.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] tcp: fix RFS vs lockless listeners
2015-10-08 18:16 [PATCH net-next] tcp: fix RFS vs lockless listeners Eric Dumazet
2015-10-08 21:11 ` Tom Herbert
@ 2015-10-11 12:33 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2015-10-11 12:33 UTC (permalink / raw)
To: eric.dumazet; +Cc: netdev, willemb, tom
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Thu, 08 Oct 2015 11:16:48 -0700
> From: Eric Dumazet <edumazet@google.com>
>
> Before recent TCP listener patches, we were updating listener
> sk->sk_rxhash before the cloning of master socket.
>
> children sk_rxhash was therefore correct after the normal 3WHS.
>
> But with lockless listener, we no longer dirty/change listener sk_rxhash
> as it would be racy.
>
> We need to correctly update the child sk_rxhash, otherwise first data
> packet wont hit correct cpu if RFS is used.
>
> Fixes: 079096f103fa ("tcp/dccp: install syn_recv requests into ehash table")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Reported-by: Willem de Bruijn <willemb@google.com>
> Cc: Tom Herbert <tom@herbertland.com>
Applied, thanks Eric.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-10-11 12:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-08 18:16 [PATCH net-next] tcp: fix RFS vs lockless listeners Eric Dumazet
2015-10-08 21:11 ` Tom Herbert
2015-10-11 12:33 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.