diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-07-08 01:47:47 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-07-08 01:47:47 -0400 |
commit | 93022136fff9e6130aa128a5ed8a599e93ac813c (patch) | |
tree | 185390fb75a3d7423cc508610b76637c957205b9 /net/ipv4/tcp.c | |
parent | c49c412a47b5102516d3313d4eba38cb1e968721 (diff) | |
parent | b7279469d66b55119784b8b9529c99c1955fe747 (diff) |
Merge commit 'v2.6.26-rc9' into x86/cpu
Diffstat (limited to 'net/ipv4/tcp.c')
-rw-r--r-- | net/ipv4/tcp.c | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index f88653138621..850825dc86e6 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -260,6 +260,8 @@ | |||
260 | #include <linux/socket.h> | 260 | #include <linux/socket.h> |
261 | #include <linux/random.h> | 261 | #include <linux/random.h> |
262 | #include <linux/bootmem.h> | 262 | #include <linux/bootmem.h> |
263 | #include <linux/highmem.h> | ||
264 | #include <linux/swap.h> | ||
263 | #include <linux/cache.h> | 265 | #include <linux/cache.h> |
264 | #include <linux/err.h> | 266 | #include <linux/err.h> |
265 | #include <linux/crypto.h> | 267 | #include <linux/crypto.h> |
@@ -1227,7 +1229,14 @@ int tcp_read_sock(struct sock *sk, read_descriptor_t *desc, | |||
1227 | copied += used; | 1229 | copied += used; |
1228 | offset += used; | 1230 | offset += used; |
1229 | } | 1231 | } |
1230 | if (offset != skb->len) | 1232 | /* |
1233 | * If recv_actor drops the lock (e.g. TCP splice | ||
1234 | * receive) the skb pointer might be invalid when | ||
1235 | * getting here: tcp_collapse might have deleted it | ||
1236 | * while aggregating skbs from the socket queue. | ||
1237 | */ | ||
1238 | skb = tcp_recv_skb(sk, seq-1, &offset); | ||
1239 | if (!skb || (offset+1 != skb->len)) | ||
1231 | break; | 1240 | break; |
1232 | } | 1241 | } |
1233 | if (tcp_hdr(skb)->fin) { | 1242 | if (tcp_hdr(skb)->fin) { |
@@ -2105,12 +2114,15 @@ static int do_tcp_setsockopt(struct sock *sk, int level, | |||
2105 | break; | 2114 | break; |
2106 | 2115 | ||
2107 | case TCP_DEFER_ACCEPT: | 2116 | case TCP_DEFER_ACCEPT: |
2108 | if (val < 0) { | 2117 | icsk->icsk_accept_queue.rskq_defer_accept = 0; |
2109 | err = -EINVAL; | 2118 | if (val > 0) { |
2110 | } else { | 2119 | /* Translate value in seconds to number of |
2111 | if (val > MAX_TCP_ACCEPT_DEFERRED) | 2120 | * retransmits */ |
2112 | val = MAX_TCP_ACCEPT_DEFERRED; | 2121 | while (icsk->icsk_accept_queue.rskq_defer_accept < 32 && |
2113 | icsk->icsk_accept_queue.rskq_defer_accept = val; | 2122 | val > ((TCP_TIMEOUT_INIT / HZ) << |
2123 | icsk->icsk_accept_queue.rskq_defer_accept)) | ||
2124 | icsk->icsk_accept_queue.rskq_defer_accept++; | ||
2125 | icsk->icsk_accept_queue.rskq_defer_accept++; | ||
2114 | } | 2126 | } |
2115 | break; | 2127 | break; |
2116 | 2128 | ||
@@ -2292,7 +2304,8 @@ static int do_tcp_getsockopt(struct sock *sk, int level, | |||
2292 | val = (val ? : sysctl_tcp_fin_timeout) / HZ; | 2304 | val = (val ? : sysctl_tcp_fin_timeout) / HZ; |
2293 | break; | 2305 | break; |
2294 | case TCP_DEFER_ACCEPT: | 2306 | case TCP_DEFER_ACCEPT: |
2295 | val = icsk->icsk_accept_queue.rskq_defer_accept; | 2307 | val = !icsk->icsk_accept_queue.rskq_defer_accept ? 0 : |
2308 | ((TCP_TIMEOUT_INIT / HZ) << (icsk->icsk_accept_queue.rskq_defer_accept - 1)); | ||
2296 | break; | 2309 | break; |
2297 | case TCP_WINDOW_CLAMP: | 2310 | case TCP_WINDOW_CLAMP: |
2298 | val = tp->window_clamp; | 2311 | val = tp->window_clamp; |
@@ -2609,7 +2622,7 @@ __setup("thash_entries=", set_thash_entries); | |||
2609 | void __init tcp_init(void) | 2622 | void __init tcp_init(void) |
2610 | { | 2623 | { |
2611 | struct sk_buff *skb = NULL; | 2624 | struct sk_buff *skb = NULL; |
2612 | unsigned long limit; | 2625 | unsigned long nr_pages, limit; |
2613 | int order, i, max_share; | 2626 | int order, i, max_share; |
2614 | 2627 | ||
2615 | BUILD_BUG_ON(sizeof(struct tcp_skb_cb) > sizeof(skb->cb)); | 2628 | BUILD_BUG_ON(sizeof(struct tcp_skb_cb) > sizeof(skb->cb)); |
@@ -2678,8 +2691,9 @@ void __init tcp_init(void) | |||
2678 | * is up to 1/2 at 256 MB, decreasing toward zero with the amount of | 2691 | * is up to 1/2 at 256 MB, decreasing toward zero with the amount of |
2679 | * memory, with a floor of 128 pages. | 2692 | * memory, with a floor of 128 pages. |
2680 | */ | 2693 | */ |
2681 | limit = min(nr_all_pages, 1UL<<(28-PAGE_SHIFT)) >> (20-PAGE_SHIFT); | 2694 | nr_pages = totalram_pages - totalhigh_pages; |
2682 | limit = (limit * (nr_all_pages >> (20-PAGE_SHIFT))) >> (PAGE_SHIFT-11); | 2695 | limit = min(nr_pages, 1UL<<(28-PAGE_SHIFT)) >> (20-PAGE_SHIFT); |
2696 | limit = (limit * (nr_pages >> (20-PAGE_SHIFT))) >> (PAGE_SHIFT-11); | ||
2683 | limit = max(limit, 128UL); | 2697 | limit = max(limit, 128UL); |
2684 | sysctl_tcp_mem[0] = limit / 4 * 3; | 2698 | sysctl_tcp_mem[0] = limit / 4 * 3; |
2685 | sysctl_tcp_mem[1] = limit; | 2699 | sysctl_tcp_mem[1] = limit; |