Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2b1b38e5 authored by Blagovest Kolenichev's avatar Blagovest Kolenichev
Browse files

Revert "tcp: free batches of packets in tcp_prune_ofo_queue()"



This reverts commit 553ffa5d.

This is a preparation change for merging android-4.14 commit
48a0bb1a into msm-4.14 branch.

The reverted change is committed already as:

751f22bb tcp: free batches of packets in tcp_prune_ofo_queue()

Change-Id: If0649a06be1904bb73418b5dbb65da11d93f7474
Signed-off-by: default avatarBlagovest Kolenichev <bkolenichev@codeaurora.org>
parent 48a0bb1a
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -3167,8 +3167,6 @@ static inline int __skb_grow_rcsum(struct sk_buff *skb, unsigned int len)
	return __skb_grow(skb, len);
}

#define rb_to_skb(rb) rb_entry_safe(rb, struct sk_buff, rbnode)

#define skb_queue_walk(queue, skb) \
		for (skb = (queue)->next;					\
		     skb != (struct sk_buff *)(queue);				\
+4 −11
Original line number Diff line number Diff line
@@ -4943,7 +4943,6 @@ static void tcp_collapse_ofo_queue(struct sock *sk)
 * 2) not add too big latencies if thousands of packets sit there.
 *    (But if application shrinks SO_RCVBUF, we could still end up
 *     freeing whole queue here)
 * 3) Drop at least 12.5 % of sk_rcvbuf to avoid malicious attacks.
 *
 * Return true if queue has shrunk.
 */
@@ -4951,26 +4950,20 @@ static bool tcp_prune_ofo_queue(struct sock *sk)
{
	struct tcp_sock *tp = tcp_sk(sk);
	struct rb_node *node, *prev;
	int goal;

	if (RB_EMPTY_ROOT(&tp->out_of_order_queue))
		return false;

	NET_INC_STATS(sock_net(sk), LINUX_MIB_OFOPRUNED);
	goal = sk->sk_rcvbuf >> 3;
	node = &tp->ooo_last_skb->rbnode;
	do {
		prev = rb_prev(node);
		rb_erase(node, &tp->out_of_order_queue);
		goal -= rb_to_skb(node)->truesize;
		tcp_drop(sk, rb_entry(node, struct sk_buff, rbnode));
		if (!prev || goal <= 0) {
		sk_mem_reclaim(sk);
		if (atomic_read(&sk->sk_rmem_alloc) <= sk->sk_rcvbuf &&
		    !tcp_under_memory_pressure(sk))
			break;
			goal = sk->sk_rcvbuf >> 3;
		}
		node = prev;
	} while (node);
	tp->ooo_last_skb = rb_entry(prev, struct sk_buff, rbnode);