aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2010-08-25 05:27:49 -0400
committerDavid S. Miller <davem@davemloft.net>2010-08-25 05:27:49 -0400
commitad1af0fedba14f82b240a03fe20eb9b2fdbd0357 (patch)
tree4d53aa8bc2d9df782aa792e52670ab55c7a44d5b /net/ipv4/tcp.c
parentb2bc85631e72485b984bcd202a104591874babba (diff)
tcp: Combat per-cpu skew in orphan tests.
As reported by Anton Blanchard when we use percpu_counter_read_positive() to make our orphan socket limit checks, the check can be off by up to num_cpus_online() * batch (which is 32 by default) which on a 128 cpu machine can be as large as the default orphan limit itself. Fix this by doing the full expensive sum check if the optimized check triggers. Reported-by: Anton Blanchard <anton@samba.org> Signed-off-by: David S. Miller <davem@davemloft.net> Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
Diffstat (limited to 'net/ipv4/tcp.c')
-rw-r--r--net/ipv4/tcp.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 176e11aaea77..197b9b77fa3e 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -2011,11 +2011,8 @@ adjudge_to_death:
2011 } 2011 }
2012 } 2012 }
2013 if (sk->sk_state != TCP_CLOSE) { 2013 if (sk->sk_state != TCP_CLOSE) {
2014 int orphan_count = percpu_counter_read_positive(
2015 sk->sk_prot->orphan_count);
2016
2017 sk_mem_reclaim(sk); 2014 sk_mem_reclaim(sk);
2018 if (tcp_too_many_orphans(sk, orphan_count)) { 2015 if (tcp_too_many_orphans(sk, 0)) {
2019 if (net_ratelimit()) 2016 if (net_ratelimit())
2020 printk(KERN_INFO "TCP: too many of orphaned " 2017 printk(KERN_INFO "TCP: too many of orphaned "
2021 "sockets\n"); 2018 "sockets\n");