From: Eric Dumazet <edumazet@google.com>
To: "David S . Miller" <davem@davemloft.net>
Cc: netdev <netdev@vger.kernel.org>,
Jean-Louis Dupond <jean-louis@dupond.be>,
Neal Cardwell <ncardwell@google.com>,
Yuchung Cheng <ycheng@google.com>,
Eric Dumazet <edumazet@google.com>,
Eric Dumazet <eric.dumazet@gmail.com>
Subject: [PATCH net-next 3/3] tcp: implement head drops in backlog queue
Date: Wed, 21 Nov 2018 09:52:40 -0800 [thread overview]
Message-ID: <20181121175240.6075-4-edumazet@google.com> (raw)
In-Reply-To: <20181121175240.6075-1-edumazet@google.com>
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@google.com>
Tested-by: Jean-Louis Dupond <jean-louis@dupond.be>
Cc: Neal Cardwell <ncardwell@google.com>
Cc: Yuchung Cheng <ycheng@google.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
next prev parent reply other threads:[~2018-11-22 4:28 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-21 17:52 [PATCH net-next 0/3] tcp: take a bit more care of backlog stress Eric Dumazet
2018-11-21 17:52 ` [PATCH net-next 1/3] tcp: remove hdrlen argument from tcp_queue_rcv() Eric Dumazet
2018-11-21 22:41 ` Yuchung Cheng
2018-11-21 17:52 ` [PATCH net-next 2/3] tcp: implement coalescing on backlog queue Eric Dumazet
2018-11-21 22:31 ` Yuchung Cheng
2018-11-21 22:40 ` Eric Dumazet
2018-11-22 16:34 ` Yuchung Cheng
2018-11-22 18:01 ` Neal Cardwell
2018-11-22 18:16 ` Eric Dumazet
2018-11-22 18:21 ` Eric Dumazet
2018-11-21 17:52 ` Eric Dumazet [this message]
2018-11-21 22:40 ` [PATCH net-next 3/3] tcp: implement head drops in " Yuchung Cheng
2018-11-21 22:47 ` Eric Dumazet
2018-11-21 23:46 ` Yuchung Cheng
2018-11-21 23:52 ` Eric Dumazet
2018-11-22 0:18 ` Eric Dumazet
2018-11-22 0:54 ` Yuchung Cheng
2018-11-22 1:01 ` Eric Dumazet
2018-11-23 19:25 ` [PATCH net-next 0/3] tcp: take a bit more care of backlog stress David Miller
2018-11-23 19:27 ` Eric Dumazet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181121175240.6075-4-edumazet@google.com \
--to=edumazet@google.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=jean-louis@dupond.be \
--cc=ncardwell@google.com \
--cc=netdev@vger.kernel.org \
--cc=ycheng@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox