diff options
author | Eric Dumazet <edumazet@google.com> | 2016-04-14 01:05:40 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-04-15 16:45:44 -0400 |
commit | 8804b2722dc5d6f9b7ba0a9e812eae9ee5ce95bc (patch) | |
tree | fd1010fca7c152ca547f02d80a02dc9d1b9d7b20 /net/ipv4/tcp_input.c | |
parent | b3d051477cf94e9d71d6acadb8a90de15237b9c1 (diff) |
tcp: remove false sharing in tcp_rcv_state_process()
Last known hot point during SYNFLOOD attack is the clearing
of rx_opt.saw_tstamp in tcp_rcv_state_process()
It is not needed for a listener, so we move it where it matters.
Performance while a SYNFLOOD hits a single listener socket
went from 5 Mpps to 6 Mpps on my test server (24 cores, 8 NIC RX queues)
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_input.c')
-rw-r--r-- | net/ipv4/tcp_input.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 7ea7034af83f..90e0d9256b74 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -5796,8 +5796,6 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb) | |||
5796 | int queued = 0; | 5796 | int queued = 0; |
5797 | bool acceptable; | 5797 | bool acceptable; |
5798 | 5798 | ||
5799 | tp->rx_opt.saw_tstamp = 0; | ||
5800 | |||
5801 | switch (sk->sk_state) { | 5799 | switch (sk->sk_state) { |
5802 | case TCP_CLOSE: | 5800 | case TCP_CLOSE: |
5803 | goto discard; | 5801 | goto discard; |
@@ -5838,6 +5836,7 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb) | |||
5838 | goto discard; | 5836 | goto discard; |
5839 | 5837 | ||
5840 | case TCP_SYN_SENT: | 5838 | case TCP_SYN_SENT: |
5839 | tp->rx_opt.saw_tstamp = 0; | ||
5841 | queued = tcp_rcv_synsent_state_process(sk, skb, th); | 5840 | queued = tcp_rcv_synsent_state_process(sk, skb, th); |
5842 | if (queued >= 0) | 5841 | if (queued >= 0) |
5843 | return queued; | 5842 | return queued; |
@@ -5849,6 +5848,7 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb) | |||
5849 | return 0; | 5848 | return 0; |
5850 | } | 5849 | } |
5851 | 5850 | ||
5851 | tp->rx_opt.saw_tstamp = 0; | ||
5852 | req = tp->fastopen_rsk; | 5852 | req = tp->fastopen_rsk; |
5853 | if (req) { | 5853 | if (req) { |
5854 | WARN_ON_ONCE(sk->sk_state != TCP_SYN_RECV && | 5854 | WARN_ON_ONCE(sk->sk_state != TCP_SYN_RECV && |