diff options
author | David S. Miller <davem@davemloft.net> | 2010-09-10 01:27:33 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-09-10 01:27:33 -0400 |
commit | e548833df83c3554229eff0672900bfe958b45fd (patch) | |
tree | 85efc4a76dc356593d6d394776aeb845dc580fb6 /net/ipv4/tcp.c | |
parent | cbd9da7be869f676afc204e1a664163778c770bd (diff) | |
parent | 053d8f6622701f849fda2ca2c9ae596c13599ba9 (diff) |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts:
net/mac80211/main.c
Diffstat (limited to 'net/ipv4/tcp.c')
-rw-r--r-- | net/ipv4/tcp.c | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index cf3254528753..3e8a4dbc721b 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -451,7 +451,8 @@ unsigned int tcp_poll(struct file *file, struct socket *sock, poll_table *wait) | |||
451 | if (sk_stream_wspace(sk) >= sk_stream_min_wspace(sk)) | 451 | if (sk_stream_wspace(sk) >= sk_stream_min_wspace(sk)) |
452 | mask |= POLLOUT | POLLWRNORM; | 452 | mask |= POLLOUT | POLLWRNORM; |
453 | } | 453 | } |
454 | } | 454 | } else |
455 | mask |= POLLOUT | POLLWRNORM; | ||
455 | 456 | ||
456 | if (tp->urg_data & TCP_URG_VALID) | 457 | if (tp->urg_data & TCP_URG_VALID) |
457 | mask |= POLLPRI; | 458 | mask |= POLLPRI; |
@@ -2011,11 +2012,8 @@ adjudge_to_death: | |||
2011 | } | 2012 | } |
2012 | } | 2013 | } |
2013 | if (sk->sk_state != TCP_CLOSE) { | 2014 | 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); | 2015 | sk_mem_reclaim(sk); |
2018 | if (tcp_too_many_orphans(sk, orphan_count)) { | 2016 | if (tcp_too_many_orphans(sk, 0)) { |
2019 | if (net_ratelimit()) | 2017 | if (net_ratelimit()) |
2020 | printk(KERN_INFO "TCP: too many of orphaned " | 2018 | printk(KERN_INFO "TCP: too many of orphaned " |
2021 | "sockets\n"); | 2019 | "sockets\n"); |
@@ -3221,7 +3219,7 @@ void __init tcp_init(void) | |||
3221 | { | 3219 | { |
3222 | struct sk_buff *skb = NULL; | 3220 | struct sk_buff *skb = NULL; |
3223 | unsigned long nr_pages, limit; | 3221 | unsigned long nr_pages, limit; |
3224 | int order, i, max_share; | 3222 | int i, max_share, cnt; |
3225 | unsigned long jiffy = jiffies; | 3223 | unsigned long jiffy = jiffies; |
3226 | 3224 | ||
3227 | BUILD_BUG_ON(sizeof(struct tcp_skb_cb) > sizeof(skb->cb)); | 3225 | BUILD_BUG_ON(sizeof(struct tcp_skb_cb) > sizeof(skb->cb)); |
@@ -3270,22 +3268,12 @@ void __init tcp_init(void) | |||
3270 | INIT_HLIST_HEAD(&tcp_hashinfo.bhash[i].chain); | 3268 | INIT_HLIST_HEAD(&tcp_hashinfo.bhash[i].chain); |
3271 | } | 3269 | } |
3272 | 3270 | ||
3273 | /* Try to be a bit smarter and adjust defaults depending | 3271 | |
3274 | * on available memory. | 3272 | cnt = tcp_hashinfo.ehash_mask + 1; |
3275 | */ | 3273 | |
3276 | for (order = 0; ((1 << order) << PAGE_SHIFT) < | 3274 | tcp_death_row.sysctl_max_tw_buckets = cnt / 2; |
3277 | (tcp_hashinfo.bhash_size * sizeof(struct inet_bind_hashbucket)); | 3275 | sysctl_tcp_max_orphans = cnt / 2; |
3278 | order++) | 3276 | sysctl_max_syn_backlog = max(128, cnt / 256); |
3279 | ; | ||
3280 | if (order >= 4) { | ||
3281 | tcp_death_row.sysctl_max_tw_buckets = 180000; | ||
3282 | sysctl_tcp_max_orphans = 4096 << (order - 4); | ||
3283 | sysctl_max_syn_backlog = 1024; | ||
3284 | } else if (order < 3) { | ||
3285 | tcp_death_row.sysctl_max_tw_buckets >>= (3 - order); | ||
3286 | sysctl_tcp_max_orphans >>= (3 - order); | ||
3287 | sysctl_max_syn_backlog = 128; | ||
3288 | } | ||
3289 | 3277 | ||
3290 | /* Set the pressure threshold to be a fraction of global memory that | 3278 | /* Set the pressure threshold to be a fraction of global memory that |
3291 | * is up to 1/2 at 256 MB, decreasing toward zero with the amount of | 3279 | * is up to 1/2 at 256 MB, decreasing toward zero with the amount of |