[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20181121175240.6075-4-edumazet@google.com>
Date: Wed, 21 Nov 2018 09:52:40 -0800
From: Eric Dumazet <edumazet@...gle.com>
To: "David S . Miller" <davem@...emloft.net>
Cc: netdev <netdev@...r.kernel.org>,
Jean-Louis Dupond <jean-louis@...ond.be>,
Neal Cardwell <ncardwell@...gle.com>,
Yuchung Cheng <ycheng@...gle.com>,
Eric Dumazet <edumazet@...gle.com>,
Eric Dumazet <eric.dumazet@...il.com>
Subject: [PATCH net-next 3/3] tcp: implement head drops in backlog queue
Under high stress, and if GRO or coalescing does not help,
we better make room in backlog queue to be able to keep latest
packet coming.
This generally helps fast recovery, given that we often receive
packets in order.
Signed-off-by: Eric Dumazet <edumazet@...gle.com>
Tested-by: Jean-Louis Dupond <jean-louis@...ond.be>
Cc: Neal Cardwell <ncardwell@...gle.com>
Cc: Yuchung Cheng <ycheng@...gle.com>
---
net/ipv4/tcp_ipv4.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 401e1d1cb904a4c7963d8baa419cfbf178593344..36c9d715bf2aa7eb7bf58b045bfeb85a2ec1a696 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -1693,6 +1693,20 @@ bool tcp_add_backlog(struct sock *sk, struct sk_buff *skb)
__skb_push(skb, hdrlen);
}
+ while (sk_rcvqueues_full(sk, limit)) {
+ struct sk_buff *head;
+
+ head = sk->sk_backlog.head;
+ if (!head)
+ break;
+ sk->sk_backlog.head = head->next;
+ if (!head->next)
+ sk->sk_backlog.tail = NULL;
+ skb_mark_not_on_list(head);
+ sk->sk_backlog.len -= head->truesize;
+ kfree_skb(head);
+ __NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPBACKLOGDROP);
+ }
/* Only socket owner can try to collapse/prune rx queues
* to reduce memory overhead, so add a little headroom here.
* Few sockets backlog are possibly concurrently non empty.
--
2.19.1.1215.g8438c0b245-goog
Powered by blists - more mailing lists