summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorVitaliy Gusev <vgusev@openvz.org>2008-04-15 20:26:34 -0700
committerDavid S. Miller <davem@davemloft.net>2008-04-15 20:26:34 -0700
commit56f367bbfd5a7439961499ca6a2f0822d2074d83 (patch)
treecdd34f6fed1fcbaa80f2fb2bf17df4fe03a316db /net
parentc4cbb34bbdaaa841ef7c027f7b420db4c318c4fd (diff)
downloadlinux-56f367bbfd5a7439961499ca6a2f0822d2074d83.tar.bz2
[TCP]: Add return value indication to tcp_prune_ofo_queue().
Returns non-zero if tp->out_of_order_queue was seen non-empty. This allows tcp_try_rmem_schedule() to return early. Signed-off-by: Vitaliy Gusev <vgusev@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/tcp_input.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 61db7b1eb995..bbb7d88a16b4 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -3841,7 +3841,7 @@ static void tcp_ofo_queue(struct sock *sk)
}
}
-static void tcp_prune_ofo_queue(struct sock *sk);
+static int tcp_prune_ofo_queue(struct sock *sk);
static int tcp_prune_queue(struct sock *sk);
static inline int tcp_try_rmem_schedule(struct sock *sk, unsigned int size)
@@ -3853,7 +3853,9 @@ static inline int tcp_try_rmem_schedule(struct sock *sk, unsigned int size)
return -1;
if (!sk_rmem_schedule(sk, size)) {
- tcp_prune_ofo_queue(sk);
+ if (!tcp_prune_ofo_queue(sk))
+ return -1;
+
if (!sk_rmem_schedule(sk, size))
return -1;
}
@@ -4211,10 +4213,12 @@ static void tcp_collapse_ofo_queue(struct sock *sk)
/*
* Purge the out-of-order queue.
+ * Return true if queue was pruned.
*/
-static void tcp_prune_ofo_queue(struct sock *sk)
+static int tcp_prune_ofo_queue(struct sock *sk)
{
struct tcp_sock *tp = tcp_sk(sk);
+ int res = 0;
if (!skb_queue_empty(&tp->out_of_order_queue)) {
NET_INC_STATS_BH(LINUX_MIB_OFOPRUNED);
@@ -4228,7 +4232,9 @@ static void tcp_prune_ofo_queue(struct sock *sk)
if (tp->rx_opt.sack_ok)
tcp_sack_reset(&tp->rx_opt);
sk_mem_reclaim(sk);
+ res = 1;
}
+ return res;
}
/* Reduce allocated memory if we can, trying to get