aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/tcp.h
diff options
context:
space:
mode:
authorArun Sharma <asharma@fb.com>2012-01-30 17:16:06 -0500
committerDavid S. Miller <davem@davemloft.net>2012-02-01 14:41:50 -0500
commitefcdbf24fd5daa88060869e51ed49f68b7ac8708 (patch)
tree8c771a1ef2c93f1ba959709d6ffb4fd56af53699 /include/net/tcp.h
parent48c3883999cb06246911e29356d194f96f1c75ef (diff)
net: Disambiguate kernel message
Some of our machines were reporting: TCP: too many of orphaned sockets even when the number of orphaned sockets was well below the limit. We print a different message depending on whether we're out of TCP memory or there are too many orphaned sockets. Also move the check out of line and cleanup the messages that were printed. Signed-off-by: Arun Sharma <asharma@fb.com> Suggested-by: Mohan Srinivasan <mohan@fb.com> Cc: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: David Miller <davem@davemloft.net> Cc: Glauber Costa <glommer@parallels.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/tcp.h')
-rw-r--r--include/net/tcp.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h
index d49db0113a06..42c29bfbcee3 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -273,6 +273,14 @@ static inline int between(__u32 seq1, __u32 seq2, __u32 seq3)
273 return seq3 - seq2 >= seq1 - seq2; 273 return seq3 - seq2 >= seq1 - seq2;
274} 274}
275 275
276static inline bool tcp_out_of_memory(struct sock *sk)
277{
278 if (sk->sk_wmem_queued > SOCK_MIN_SNDBUF &&
279 sk_memory_allocated(sk) > sk_prot_mem_limits(sk, 2))
280 return true;
281 return false;
282}
283
276static inline bool tcp_too_many_orphans(struct sock *sk, int shift) 284static inline bool tcp_too_many_orphans(struct sock *sk, int shift)
277{ 285{
278 struct percpu_counter *ocp = sk->sk_prot->orphan_count; 286 struct percpu_counter *ocp = sk->sk_prot->orphan_count;
@@ -283,13 +291,11 @@ static inline bool tcp_too_many_orphans(struct sock *sk, int shift)
283 if (orphans << shift > sysctl_tcp_max_orphans) 291 if (orphans << shift > sysctl_tcp_max_orphans)
284 return true; 292 return true;
285 } 293 }
286
287 if (sk->sk_wmem_queued > SOCK_MIN_SNDBUF &&
288 sk_memory_allocated(sk) > sk_prot_mem_limits(sk, 2))
289 return true;
290 return false; 294 return false;
291} 295}
292 296
297extern bool tcp_check_oom(struct sock *sk, int shift);
298
293/* syncookies: remember time of last synqueue overflow */ 299/* syncookies: remember time of last synqueue overflow */
294static inline void tcp_synq_overflow(struct sock *sk) 300static inline void tcp_synq_overflow(struct sock *sk)
295{ 301{