Skip to contentSkip to conversation

tcp: remove prequeue and header prediction

RFC In review Florian Westphal 5 participants 13 messages Jul 27, 2017 – Jul 31, 2017

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover tcp: remove prequeue and header prediction

This RFC removes tcp prequeueing and header prediction support.

After a hallway discussion with Eric Dumazet some maybe-not-so-useful-anymore TCP stack features came up, HP and Prequeue among these.

So this RFC proposes to axe both.

In brief, TCP prequeue assumes a single-process-blocking-read design, which is not that common anymore, and the most frequently used high-performance networking program that does this is netperf :)

With more commong (e)poll designs, prequeue doesn't work.

The idea behind prequeueing isn't so bad in itself; it moves part of tcp processing -- including ack processing (including retransmit queue processing) into process context. However, removing it would not just avoid some code, for most programs it elimiates dead code.

As processing then always occurs in BH context, it would allow us to experiment e.g. with bulk-freeing of skb heads when a packet acks data on the retransmit queue.

Header prediction is also less useful nowadays.
For packet trains, GRO will aggregate packets so we do not get a per-packet benefit.
Header prediction will also break down with light packet loss due to SACK.

So, In short: What do others think?

Florian Westphal (6):
tcp: remove prequeue support
tcp: reindent two spots after prequeue removal
tcp: remove low_latency sysctl
tcp: remove header prediction
tcp: remove CA_ACK_SLOWPATH
tcp: remove unused mib counters

 Documentation/networking/ip-sysctl.txt |    7 
 include/linux/tcp.h                    |   15 -
 include/net/tcp.h                      |   40 ----
 include/uapi/linux/snmp.h              |    8 
 net/ipv4/proc.c                        |    8 
 net/ipv4/sysctl_net_ipv4.c             |    3 
 net/ipv4/tcp.c                         |  109 -----------
 net/ipv4/tcp_input.c                   |  303 +++------------------------------
 net/ipv4/tcp_ipv4.c                    |   63 ------
 net/ipv4/tcp_minisocks.c               |    3 
 net/ipv4/tcp_output.c                  |    2 
 net/ipv4/tcp_timer.c                   |   12 -
 net/ipv4/tcp_westwood.c                |   31 ---
 net/ipv6/tcp_ipv6.c                    |    3 
 14 files changed, 43 insertions(+), 564 deletions(-)
#1 lore raw

RFC PATCH 1/6 tcp: remove prequeue support

prequeue is a tcp receive optimization that moves part of rx processing from bh to process context.

This only works if the socket being processed belongs to a process that blocks in recv on this socket. In practice, this doesn't happen anymore that often, as servers normally use an event driven (epoll) model.

Even normal clients (e.g. web browsers) commonly use many tcp connections in parallel.

Lets remove this.

This has measure impact only on netperf from host to local vm. There are no changes with bulk transfers that use select/poll etc. to get notified about new data.

I also see no changes when using netperf between two physical hosts with ixgbe interfaces.

---
 include/linux/tcp.h      |   9 ----
 include/net/tcp.h        |  11 -----
 net/ipv4/tcp.c           | 105 -----------------------------------------------
 net/ipv4/tcp_input.c     |  62 ----------------------------
 net/ipv4/tcp_ipv4.c      |  61 +--------------------------
 net/ipv4/tcp_minisocks.c |   1 -
 net/ipv4/tcp_timer.c     |  12 ------
 net/ipv6/tcp_ipv6.c      |   3 +-
 8 files changed, 2 insertions(+), 262 deletions(-)
include/linux/tcp.h +0 -9
index 542ca1ae02c4..32fb37cfb0d1 100644
@@ -192,15 +192,6 @@ struct tcp_sock {
 
 	struct list_head tsq_node; /* anchor in tsq_tasklet.head list */
 
-	/* Data for direct copy to user */
-	struct {
-		struct sk_buff_head	prequeue;
-		struct task_struct	*task;
-		struct msghdr		*msg;
-		int			memory;
-		int			len;
-	} ucopy;
-
 	u32	snd_wl1;	/* Sequence for window update		*/
 	u32	snd_wnd;	/* The window we expect to receive	*/
 	u32	max_window;	/* Maximal window ever seen from peer	*/
include/net/tcp.h +0 -11
index 12d68335acd4..93f115cfc8f8 100644
@@ -1244,17 +1244,6 @@ static inline bool tcp_checksum_complete(struct sk_buff *skb)
 		__tcp_checksum_complete(skb);
 }
 
-/* Prequeue for VJ style copy to user, combined with checksumming. */
-
-static inline void tcp_prequeue_init(struct tcp_sock *tp)
-{
-	tp->ucopy.task = NULL;
-	tp->ucopy.len = 0;
-	tp->ucopy.memory = 0;
-	skb_queue_head_init(&tp->ucopy.prequeue);
-}
-
-bool tcp_prequeue(struct sock *sk, struct sk_buff *skb);
 bool tcp_add_backlog(struct sock *sk, struct sk_buff *skb);
 int tcp_filter(struct sock *sk, struct sk_buff *skb);
 
net/ipv4/tcp.c +0 -105

141 lines not on this page · raw message

net/ipv4/tcp_input.c +0 -62

80 lines not on this page · raw message

net/ipv4/tcp_ipv4.c +1 -60

79 lines not on this page · raw message

net/ipv4/tcp_minisocks.c +0 -1
index 0ff83c1637d8..188a6f31356d 100644
@@ -445,7 +445,6 @@ struct sock *tcp_create_openreq_child(const struct sock *sk,
 		newtp->snd_sml = newtp->snd_una =
 		newtp->snd_nxt = newtp->snd_up = treq->snt_isn + 1;
 
-		tcp_prequeue_init(newtp);
 		INIT_LIST_HEAD(&newtp->tsq_node);
 
 		tcp_init_wl(newtp, treq->rcv_isn);
net/ipv4/tcp_timer.c +0 -12
index c0feeeef962a..f753f9d2fee3 100644
@@ -239,7 +239,6 @@ static int tcp_write_timeout(struct sock *sk)
 /* Called with BH disabled */
 void tcp_delack_timer_handler(struct sock *sk)
 {
-	struct tcp_sock *tp = tcp_sk(sk);
 	struct inet_connection_sock *icsk = inet_csk(sk);
 
 	sk_mem_reclaim_partial(sk);
@@ -254,17 +253,6 @@ void tcp_delack_timer_handler(struct sock *sk)
 	}
 	icsk->icsk_ack.pending &= ~ICSK_ACK_TIMER;
 
-	if (!skb_queue_empty(&tp->ucopy.prequeue)) {
-		struct sk_buff *skb;
-
-		__NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPSCHEDULERFAILED);
-
-		while ((skb = __skb_dequeue(&tp->ucopy.prequeue)) != NULL)
-			sk_backlog_rcv(sk, skb);
-
-		tp->ucopy.memory = 0;
-	}
-
 	if (inet_csk_ack_scheduled(sk)) {
 		if (!icsk->icsk_ack.pingpong) {
 			/* Delayed ACK missed: inflate ATO. */
net/ipv6/tcp_ipv6.c +1 -2
index 90a32576c3d0..ced5dcf37465 100644
@@ -1505,8 +1505,7 @@ static int tcp_v6_rcv(struct sk_buff *skb)
 	tcp_segs_in(tcp_sk(sk), skb);
 	ret = 0;
 	if (!sock_owned_by_user(sk)) {
-		if (!tcp_prequeue(sk, skb))
-			ret = tcp_v6_do_rcv(sk, skb);
+		ret = tcp_v6_do_rcv(sk, skb);
 	} else if (tcp_add_backlog(sk, skb)) {
 		goto discard_and_relse;
 	}
Signature · 1 line
2.13.0
#2 lore raw

RFC PATCH 2/6 tcp: reindent two spots after prequeue removal

In reply to Florian Westphal

These two branches are now always true, remove the conditional. objdiff shows no changes.

---
 net/ipv4/tcp_input.c | 50 +++++++++++++++++++++++---------------------------
 1 file changed, 23 insertions(+), 27 deletions(-)
net/ipv4/tcp_input.c +23 -27
index 770ce6cb3eca..87efde9f5a90 100644
@@ -4611,16 +4611,14 @@ static void tcp_data_queue(struct sock *sk, struct sk_buff *skb)
 			goto out_of_window;
 
 		/* Ok. In sequence. In window. */
-		if (eaten <= 0) {
 queue_and_out:
-			if (eaten < 0) {
-				if (skb_queue_len(&sk->sk_receive_queue) == 0)
-					sk_forced_mem_schedule(sk, skb->truesize);
-				else if (tcp_try_rmem_schedule(sk, skb, skb->truesize))
-					goto drop;
-			}
-			eaten = tcp_queue_rcv(sk, skb, 0, &fragstolen);
+		if (eaten < 0) {
+			if (skb_queue_len(&sk->sk_receive_queue) == 0)
+				sk_forced_mem_schedule(sk, skb->truesize);
+			else if (tcp_try_rmem_schedule(sk, skb, skb->truesize))
+				goto drop;
 		}
+		eaten = tcp_queue_rcv(sk, skb, 0, &fragstolen);
 		tcp_rcv_nxt_update(tp, TCP_SKB_CB(skb)->end_seq);
 		if (skb->len)
 			tcp_event_data_recv(sk, skb);
@@ -5410,30 +5408,28 @@ void tcp_rcv_established(struct sock *sk, struct sk_buff *skb,
 			int eaten = 0;
 			bool fragstolen = false;
 
-			if (!eaten) {
-				if (tcp_checksum_complete(skb))
-					goto csum_error;
+			if (tcp_checksum_complete(skb))
+				goto csum_error;
 
-				if ((int)skb->truesize > sk->sk_forward_alloc)
-					goto step5;
+			if ((int)skb->truesize > sk->sk_forward_alloc)
+				goto step5;
 
-				/* Predicted packet is in window by definition.
-				 * seq == rcv_nxt and rcv_wup <= rcv_nxt.
-				 * Hence, check seq<=rcv_wup reduces to:
-				 */
-				if (tcp_header_len ==
-				    (sizeof(struct tcphdr) + TCPOLEN_TSTAMP_ALIGNED) &&
-				    tp->rcv_nxt == tp->rcv_wup)
-					tcp_store_ts_recent(tp);
+			/* Predicted packet is in window by definition.
+			 * seq == rcv_nxt and rcv_wup <= rcv_nxt.
+			 * Hence, check seq<=rcv_wup reduces to:
+			 */
+			if (tcp_header_len ==
+			    (sizeof(struct tcphdr) + TCPOLEN_TSTAMP_ALIGNED) &&
+			    tp->rcv_nxt == tp->rcv_wup)
+				tcp_store_ts_recent(tp);
 
-				tcp_rcv_rtt_measure_ts(sk, skb);
+			tcp_rcv_rtt_measure_ts(sk, skb);
 
-				NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPHPHITS);
+			NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPHPHITS);
 
-				/* Bulk data transfer: receiver */
-				eaten = tcp_queue_rcv(sk, skb, tcp_header_len,
-						      &fragstolen);
-			}
+			/* Bulk data transfer: receiver */
+			eaten = tcp_queue_rcv(sk, skb, tcp_header_len,
+					      &fragstolen);
 
 			tcp_event_data_recv(sk, skb);
 
Signature · 1 line
2.13.0
#3 lore raw

RFC PATCH 3/6 tcp: remove low_latency sysctl

In reply to Florian Westphal

this option was used by the removed prequeue code, it has no effect anymore.

---
 Documentation/networking/ip-sysctl.txt | 7 +------
 include/net/tcp.h                      | 1 -
 net/ipv4/sysctl_net_ipv4.c             | 3 +++
 net/ipv4/tcp_ipv4.c                    | 2 --
 4 files changed, 4 insertions(+), 9 deletions(-)
Documentation/networking/ip-sysctl.txt +1 -6
index f485d553e65c..84c9b8cee780 100644
@@ -353,12 +353,7 @@ tcp_l3mdev_accept - BOOLEAN
 	compiled with CONFIG_NET_L3_MASTER_DEV.
 
 tcp_low_latency - BOOLEAN
-	If set, the TCP stack makes decisions that prefer lower
-	latency as opposed to higher throughput.  By default, this
-	option is not set meaning that higher throughput is preferred.
-	An example of an application where this default should be
-	changed would be a Beowulf compute cluster.
-	Default: 0
+	This is a legacy option, it has no effect anymore.
 
 tcp_max_orphans - INTEGER
 	Maximal number of TCP sockets not attached to any user file handle,
include/net/tcp.h +0 -1
index 93f115cfc8f8..8507c81fb0e9 100644
@@ -256,7 +256,6 @@ extern int sysctl_tcp_rmem[3];
 extern int sysctl_tcp_app_win;
 extern int sysctl_tcp_adv_win_scale;
 extern int sysctl_tcp_frto;
-extern int sysctl_tcp_low_latency;
 extern int sysctl_tcp_nometrics_save;
 extern int sysctl_tcp_moderate_rcvbuf;
 extern int sysctl_tcp_tso_win_divisor;
net/ipv4/sysctl_net_ipv4.c +3 -0
index 9bf809726066..0d3c038d7b04 100644
@@ -45,6 +45,9 @@ static int tcp_syn_retries_max = MAX_TCP_SYNCNT;
 static int ip_ping_group_range_min[] = { 0, 0 };
 static int ip_ping_group_range_max[] = { GID_T_MAX, GID_T_MAX };
 
+/* obsolete */
+static int sysctl_tcp_low_latency __read_mostly;
+
 /* Update system visible IP port range */
 static void set_local_port_range(struct net *net, int range[2])
 {
net/ipv4/tcp_ipv4.c +0 -2
index a68eb4577d36..9b51663cd5a4 100644
@@ -85,8 +85,6 @@
 #include <crypto/hash.h>
 #include <linux/scatterlist.h>
 
-int sysctl_tcp_low_latency __read_mostly;
-
 #ifdef CONFIG_TCP_MD5SIG
 static int tcp_v4_md5_hash_hdr(char *md5_hash, const struct tcp_md5sig_key *key,
 			       __be32 daddr, __be32 saddr, const struct tcphdr *th);
Signature · 1 line
2.13.0
#4 lore raw

RFC PATCH 4/6 tcp: remove header prediction

In reply to Florian Westphal

Like prequeue, I am not sure this is overly useful nowadays.

If we receive a train of packets, GRO will aggregate them if the headers are the same (HP predates GRO by several years) so we don't get a per-packet benefit, only a per-aggregated-packet one.

---
 include/linux/tcp.h      |   6 --
 include/net/tcp.h        |  23 ------
 net/ipv4/tcp.c           |   4 +-
 net/ipv4/tcp_input.c     | 192 +++--------------------------------------------
 net/ipv4/tcp_minisocks.c |   2 -
 net/ipv4/tcp_output.c    |   2 -
 6 files changed, 10 insertions(+), 219 deletions(-)
include/linux/tcp.h +0 -6
index 32fb37cfb0d1..d7389ea36e10 100644
@@ -148,12 +148,6 @@ struct tcp_sock {
 	u16	gso_segs;	/* Max number of segs per GSO packet	*/
 
 /*
- *	Header prediction flags
- *	0x5?10 << 16 + snd_wnd in net byte order
- */
-	__be32	pred_flags;
-
-/*
  *	RFC793 variables by their proper names. This means you can
  *	read the code and the spec side by side (and laugh ...)
  *	See RFC793 and RFC1122. The RFC writes these in capitals.
include/net/tcp.h +0 -23
index 8507c81fb0e9..8f11b82b5b5a 100644
@@ -631,29 +631,6 @@ static inline u32 __tcp_set_rto(const struct tcp_sock *tp)
 	return usecs_to_jiffies((tp->srtt_us >> 3) + tp->rttvar_us);
 }
 
-static inline void __tcp_fast_path_on(struct tcp_sock *tp, u32 snd_wnd)
-{
-	tp->pred_flags = htonl((tp->tcp_header_len << 26) |
-			       ntohl(TCP_FLAG_ACK) |
-			       snd_wnd);
-}
-
-static inline void tcp_fast_path_on(struct tcp_sock *tp)
-{
-	__tcp_fast_path_on(tp, tp->snd_wnd >> tp->rx_opt.snd_wscale);
-}
-
-static inline void tcp_fast_path_check(struct sock *sk)
-{
-	struct tcp_sock *tp = tcp_sk(sk);
-
-	if (RB_EMPTY_ROOT(&tp->out_of_order_queue) &&
-	    tp->rcv_wnd &&
-	    atomic_read(&sk->sk_rmem_alloc) < sk->sk_rcvbuf &&
-	    !tp->urg_data)
-		tcp_fast_path_on(tp);
-}
-
 /* Compute the actual rto_min value */
 static inline u32 tcp_rto_min(struct sock *sk)
 {
net/ipv4/tcp.c +1 -3
index 62018ea6f45f..e022874d509f 100644
@@ -1848,10 +1848,8 @@ int tcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int nonblock,
 		tcp_rcv_space_adjust(sk);
 
 skip_copy:
-		if (tp->urg_data && after(tp->copied_seq, tp->urg_seq)) {
+		if (tp->urg_data && after(tp->copied_seq, tp->urg_seq))
 			tp->urg_data = 0;
-			tcp_fast_path_check(sk);
-		}
 		if (used + offset < skb->len)
 			continue;
 
net/ipv4/tcp_input.c +9 -183

282 lines not on this page · raw message

net/ipv4/tcp_minisocks.c +0 -2
index 188a6f31356d..1537b87c657f 100644
@@ -436,8 +436,6 @@ struct sock *tcp_create_openreq_child(const struct sock *sk,
 		struct tcp_sock *newtp = tcp_sk(newsk);
 
 		/* Now setup tcp_sock */
-		newtp->pred_flags = 0;
-
 		newtp->rcv_wup = newtp->copied_seq =
 		newtp->rcv_nxt = treq->rcv_isn + 1;
 		newtp->segs_in = 1;
net/ipv4/tcp_output.c +0 -2
index 886d874775df..8380464aead1 100644
@@ -295,9 +295,7 @@ static u16 tcp_select_window(struct sock *sk)
 	/* RFC1323 scaling applied */
 	new_win >>= tp->rx_opt.rcv_wscale;
 
-	/* If we advertise zero window, disable fast path. */
 	if (new_win == 0) {
-		tp->pred_flags = 0;
 		if (old_win)
 			NET_INC_STATS(sock_net(sk),
 				      LINUX_MIB_TCPTOZEROWINDOWADV);
Signature · 1 line
2.13.0
#5 lore raw

RFC PATCH 5/6 tcp: remove CA_ACK_SLOWPATH

In reply to Florian Westphal

re-indent tcp_ack, and remove CA_ACK_SLOWPATH; it is always set now.

---
 include/net/tcp.h       |  5 ++---
 net/ipv4/tcp_input.c    | 35 ++++++++++++++++-------------------
 net/ipv4/tcp_westwood.c | 31 ++++---------------------------
 3 files changed, 22 insertions(+), 49 deletions(-)
include/net/tcp.h +2 -3
index 8f11b82b5b5a..3ecb62811004 100644
@@ -880,9 +880,8 @@ enum tcp_ca_event {
 
 /* Information about inbound ACK, passed to cong_ops->in_ack_event() */
 enum tcp_ca_ack_event_flags {
-	CA_ACK_SLOWPATH		= (1 << 0),	/* In slow path processing */
-	CA_ACK_WIN_UPDATE	= (1 << 1),	/* ACK updated window */
-	CA_ACK_ECE		= (1 << 2),	/* ECE bit is set on ack */
+	CA_ACK_WIN_UPDATE	= (1 << 0),	/* ACK updated window */
+	CA_ACK_ECE		= (1 << 1),	/* ECE bit is set on ack */
 };
 
 /*
net/ipv4/tcp_input.c +16 -19
index bfde9d7d210e..af0a98d54b62 100644
@@ -3547,6 +3547,7 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag)
 	u32 lost = tp->lost;
 	int acked = 0; /* Number of packets newly acked */
 	int rexmit = REXMIT_NONE; /* Flag to (re)transmit to recover losses */
+	u32 ack_ev_flags = 0;
 
 	sack_state.first_sackt = 0;
 	sack_state.rate = &rs;
@@ -3590,30 +3591,26 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag)
 	if (flag & FLAG_UPDATE_TS_RECENT)
 		tcp_replace_ts_recent(tp, TCP_SKB_CB(skb)->seq);
 
-	{
-		u32 ack_ev_flags = CA_ACK_SLOWPATH;
-
-		if (ack_seq != TCP_SKB_CB(skb)->end_seq)
-			flag |= FLAG_DATA;
-		else
-			NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPPUREACKS);
+	if (ack_seq != TCP_SKB_CB(skb)->end_seq)
+		flag |= FLAG_DATA;
+	else
+		NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPPUREACKS);
 
-		flag |= tcp_ack_update_window(sk, skb, ack, ack_seq);
+	flag |= tcp_ack_update_window(sk, skb, ack, ack_seq);
 
-		if (TCP_SKB_CB(skb)->sacked)
-			flag |= tcp_sacktag_write_queue(sk, skb, prior_snd_una,
-							&sack_state);
+	if (TCP_SKB_CB(skb)->sacked)
+		flag |= tcp_sacktag_write_queue(sk, skb, prior_snd_una,
+						&sack_state);
 
-		if (tcp_ecn_rcv_ecn_echo(tp, tcp_hdr(skb))) {
-			flag |= FLAG_ECE;
-			ack_ev_flags |= CA_ACK_ECE;
-		}
+	if (tcp_ecn_rcv_ecn_echo(tp, tcp_hdr(skb))) {
+		flag |= FLAG_ECE;
+		ack_ev_flags = CA_ACK_ECE;
+	}
 
-		if (flag & FLAG_WIN_UPDATE)
-			ack_ev_flags |= CA_ACK_WIN_UPDATE;
+	if (flag & FLAG_WIN_UPDATE)
+		ack_ev_flags |= CA_ACK_WIN_UPDATE;
 
-		tcp_in_ack_event(sk, ack_ev_flags);
-	}
+	tcp_in_ack_event(sk, ack_ev_flags);
 
 	/* We passed data and got it acked, remove any soft error
 	 * log. Something worked...
net/ipv4/tcp_westwood.c +4 -27
index bec9cafbe3f9..e5de84310949 100644
@@ -154,24 +154,6 @@ static inline void update_rtt_min(struct westwood *w)
 }
 
 /*
- * @westwood_fast_bw
- * It is called when we are in fast path. In particular it is called when
- * header prediction is successful. In such case in fact update is
- * straight forward and doesn't need any particular care.
- */
-static inline void westwood_fast_bw(struct sock *sk)
-{
-	const struct tcp_sock *tp = tcp_sk(sk);
-	struct westwood *w = inet_csk_ca(sk);
-
-	westwood_update_window(sk);
-
-	w->bk += tp->snd_una - w->snd_una;
-	w->snd_una = tp->snd_una;
-	update_rtt_min(w);
-}
-
-/*
  * @westwood_acked_count
  * This function evaluates cumul_ack for evaluating bk in case of
  * delayed or partial acks.
@@ -223,17 +205,12 @@ static u32 tcp_westwood_bw_rttmin(const struct sock *sk)
 
 static void tcp_westwood_ack(struct sock *sk, u32 ack_flags)
 {
-	if (ack_flags & CA_ACK_SLOWPATH) {
-		struct westwood *w = inet_csk_ca(sk);
-
-		westwood_update_window(sk);
-		w->bk += westwood_acked_count(sk);
+	struct westwood *w = inet_csk_ca(sk);
 
-		update_rtt_min(w);
-		return;
-	}
+	westwood_update_window(sk);
+	w->bk += westwood_acked_count(sk);
 
-	westwood_fast_bw(sk);
+	update_rtt_min(w);
 }
 
 static void tcp_westwood_event(struct sock *sk, enum tcp_ca_event event)
Signature · 1 line
2.13.0
#6 lore raw

RFC PATCH 6/6 tcp: remove unused mib counters

In reply to Florian Westphal

was used by tcp prequeue, TCPFORWARDRETRANS use was removed in january.

---
 include/uapi/linux/snmp.h | 8 --------
 net/ipv4/proc.c           | 8 --------
 2 files changed, 16 deletions(-)
include/uapi/linux/snmp.h +0 -8
index d85693295798..73c15719fd35 100644
@@ -185,13 +185,7 @@ enum
 	LINUX_MIB_LISTENOVERFLOWS,		/* ListenOverflows */
 	LINUX_MIB_LISTENDROPS,			/* ListenDrops */
 	LINUX_MIB_TCPPREQUEUED,			/* TCPPrequeued */
-	LINUX_MIB_TCPDIRECTCOPYFROMBACKLOG,	/* TCPDirectCopyFromBacklog */
-	LINUX_MIB_TCPDIRECTCOPYFROMPREQUEUE,	/* TCPDirectCopyFromPrequeue */
-	LINUX_MIB_TCPPREQUEUEDROPPED,		/* TCPPrequeueDropped */
-	LINUX_MIB_TCPHPHITS,			/* TCPHPHits */
-	LINUX_MIB_TCPHPHITSTOUSER,		/* TCPHPHitsToUser */
 	LINUX_MIB_TCPPUREACKS,			/* TCPPureAcks */
-	LINUX_MIB_TCPHPACKS,			/* TCPHPAcks */
 	LINUX_MIB_TCPRENORECOVERY,		/* TCPRenoRecovery */
 	LINUX_MIB_TCPSACKRECOVERY,		/* TCPSackRecovery */
 	LINUX_MIB_TCPSACKRENEGING,		/* TCPSACKReneging */
@@ -208,14 +202,12 @@ enum
 	LINUX_MIB_TCPSACKFAILURES,		/* TCPSackFailures */
 	LINUX_MIB_TCPLOSSFAILURES,		/* TCPLossFailures */
 	LINUX_MIB_TCPFASTRETRANS,		/* TCPFastRetrans */
-	LINUX_MIB_TCPFORWARDRETRANS,		/* TCPForwardRetrans */
 	LINUX_MIB_TCPSLOWSTARTRETRANS,		/* TCPSlowStartRetrans */
 	LINUX_MIB_TCPTIMEOUTS,			/* TCPTimeouts */
 	LINUX_MIB_TCPLOSSPROBES,		/* TCPLossProbes */
 	LINUX_MIB_TCPLOSSPROBERECOVERY,		/* TCPLossProbeRecovery */
 	LINUX_MIB_TCPRENORECOVERYFAIL,		/* TCPRenoRecoveryFail */
 	LINUX_MIB_TCPSACKRECOVERYFAIL,		/* TCPSackRecoveryFail */
-	LINUX_MIB_TCPSCHEDULERFAILED,		/* TCPSchedulerFailed */
 	LINUX_MIB_TCPRCVCOLLAPSED,		/* TCPRcvCollapsed */
 	LINUX_MIB_TCPDSACKOLDSENT,		/* TCPDSACKOldSent */
 	LINUX_MIB_TCPDSACKOFOSENT,		/* TCPDSACKOfoSent */
net/ipv4/proc.c +0 -8
index 43eb6567b3a0..e2c91375cadc 100644
@@ -207,13 +207,7 @@ static const struct snmp_mib snmp4_net_list[] = {
 	SNMP_MIB_ITEM("ListenOverflows", LINUX_MIB_LISTENOVERFLOWS),
 	SNMP_MIB_ITEM("ListenDrops", LINUX_MIB_LISTENDROPS),
 	SNMP_MIB_ITEM("TCPPrequeued", LINUX_MIB_TCPPREQUEUED),
-	SNMP_MIB_ITEM("TCPDirectCopyFromBacklog", LINUX_MIB_TCPDIRECTCOPYFROMBACKLOG),
-	SNMP_MIB_ITEM("TCPDirectCopyFromPrequeue", LINUX_MIB_TCPDIRECTCOPYFROMPREQUEUE),
-	SNMP_MIB_ITEM("TCPPrequeueDropped", LINUX_MIB_TCPPREQUEUEDROPPED),
-	SNMP_MIB_ITEM("TCPHPHits", LINUX_MIB_TCPHPHITS),
-	SNMP_MIB_ITEM("TCPHPHitsToUser", LINUX_MIB_TCPHPHITSTOUSER),
 	SNMP_MIB_ITEM("TCPPureAcks", LINUX_MIB_TCPPUREACKS),
-	SNMP_MIB_ITEM("TCPHPAcks", LINUX_MIB_TCPHPACKS),
 	SNMP_MIB_ITEM("TCPRenoRecovery", LINUX_MIB_TCPRENORECOVERY),
 	SNMP_MIB_ITEM("TCPSackRecovery", LINUX_MIB_TCPSACKRECOVERY),
 	SNMP_MIB_ITEM("TCPSACKReneging", LINUX_MIB_TCPSACKRENEGING),
@@ -230,14 +224,12 @@ static const struct snmp_mib snmp4_net_list[] = {
 	SNMP_MIB_ITEM("TCPSackFailures", LINUX_MIB_TCPSACKFAILURES),
 	SNMP_MIB_ITEM("TCPLossFailures", LINUX_MIB_TCPLOSSFAILURES),
 	SNMP_MIB_ITEM("TCPFastRetrans", LINUX_MIB_TCPFASTRETRANS),
-	SNMP_MIB_ITEM("TCPForwardRetrans", LINUX_MIB_TCPFORWARDRETRANS),
 	SNMP_MIB_ITEM("TCPSlowStartRetrans", LINUX_MIB_TCPSLOWSTARTRETRANS),
 	SNMP_MIB_ITEM("TCPTimeouts", LINUX_MIB_TCPTIMEOUTS),
 	SNMP_MIB_ITEM("TCPLossProbes", LINUX_MIB_TCPLOSSPROBES),
 	SNMP_MIB_ITEM("TCPLossProbeRecovery", LINUX_MIB_TCPLOSSPROBERECOVERY),
 	SNMP_MIB_ITEM("TCPRenoRecoveryFail", LINUX_MIB_TCPRENORECOVERYFAIL),
 	SNMP_MIB_ITEM("TCPSackRecoveryFail", LINUX_MIB_TCPSACKRECOVERYFAIL),
-	SNMP_MIB_ITEM("TCPSchedulerFailed", LINUX_MIB_TCPSCHEDULERFAILED),
 	SNMP_MIB_ITEM("TCPRcvCollapsed", LINUX_MIB_TCPRCVCOLLAPSED),
 	SNMP_MIB_ITEM("TCPDSACKOldSent", LINUX_MIB_TCPDSACKOLDSENT),
 	SNMP_MIB_ITEM("TCPDSACKOfoSent", LINUX_MIB_TCPDSACKOFOSENT),
Signature · 1 line
2.13.0
#7 lore raw
In reply to Florian Westphal
Quoted 25 lines · Florian Westphal

This RFC removes tcp prequeueing and header prediction support.

After a hallway discussion with Eric Dumazet some maybe-not-so-useful-anymore TCP stack features came up, HP and Prequeue among these.

So this RFC proposes to axe both.

In brief, TCP prequeue assumes a single-process-blocking-read design, which is not that common anymore, and the most frequently used high-performance networking program that does this is netperf :)

With more commong (e)poll designs, prequeue doesn't work.

The idea behind prequeueing isn't so bad in itself; it moves part of tcp processing -- including ack processing (including retransmit queue processing) into process context. However, removing it would not just avoid some code, for most programs it elimiates dead code.

As processing then always occurs in BH context, it would allow us to experiment e.g. with bulk-freeing of skb heads when a packet acks data on the retransmit queue.

Quoted 6 lines

Header prediction is also less useful nowadays.
For packet trains, GRO will aggregate packets so we do not get a per-packet benefit.
Header prediction will also break down with light packet loss due to SACK.

So, In short: What do others think?

+2 for this move. Will review the patches soon.

Quoted 25 lines

Florian Westphal (6):
tcp: remove prequeue support
tcp: reindent two spots after prequeue removal
tcp: remove low_latency sysctl
tcp: remove header prediction
tcp: remove CA_ACK_SLOWPATH
tcp: remove unused mib counters

 Documentation/networking/ip-sysctl.txt |    7
 include/linux/tcp.h                    |   15 -
 include/net/tcp.h                      |   40 ----
 include/uapi/linux/snmp.h              |    8
 net/ipv4/proc.c                        |    8
 net/ipv4/sysctl_net_ipv4.c             |    3
 net/ipv4/tcp.c                         |  109 -----------
 net/ipv4/tcp_input.c                   |  303 +++------------------------------
 net/ipv4/tcp_ipv4.c                    |   63 ------
 net/ipv4/tcp_minisocks.c               |    3
 net/ipv4/tcp_output.c                  |    2
 net/ipv4/tcp_timer.c                   |   12 -
 net/ipv4/tcp_westwood.c                |   31 ---
 net/ipv6/tcp_ipv6.c                    |    3
 14 files changed, 43 insertions(+), 564 deletions(-)
maintainer
#8 lore raw
In reply to Florian Westphal

From: Florian Westphal <[email protected]>
Date: Fri, 28 Jul 2017 01:31:11 +0200

Quoted 24 lines

This RFC removes tcp prequeueing and header prediction support.

After a hallway discussion with Eric Dumazet some maybe-not-so-useful-anymore TCP stack features came up, HP and Prequeue among these.

So this RFC proposes to axe both.

In brief, TCP prequeue assumes a single-process-blocking-read design, which is not that common anymore, and the most frequently used high-performance networking program that does this is netperf :)

With more commong (e)poll designs, prequeue doesn't work.

The idea behind prequeueing isn't so bad in itself; it moves part of tcp processing -- including ack processing (including retransmit queue processing) into process context. However, removing it would not just avoid some code, for most programs it elimiates dead code.

As processing then always occurs in BH context, it would allow us to experiment e.g. with bulk-freeing of skb heads when a packet acks data on the retransmit queue.

Quoted 6 lines

Header prediction is also less useful nowadays.
For packet trains, GRO will aggregate packets so we do not get a per-packet benefit.
Header prediction will also break down with light packet loss due to SACK.

So, In short: What do others think?

I have no objections to any of this. :)

maintainer
#9 lore raw
In reply to Florian Westphal
Quoted 39 lines · Florian Westphal

This RFC removes tcp prequeueing and header prediction support.

After a hallway discussion with Eric Dumazet some maybe-not-so-useful-anymore TCP stack features came up, HP and Prequeue among these.

So this RFC proposes to axe both.

In brief, TCP prequeue assumes a single-process-blocking-read design, which is not that common anymore, and the most frequently used high-performance networking program that does this is netperf :)

With more commong (e)poll designs, prequeue doesn't work.

The idea behind prequeueing isn't so bad in itself; it moves part of tcp processing -- including ack processing (including retransmit queue processing) into process context. However, removing it would not just avoid some code, for most programs it elimiates dead code.

As processing then always occurs in BH context, it would allow us to experiment e.g. with bulk-freeing of skb heads when a packet acks data on the retransmit queue.

Header prediction is also less useful nowadays.
For packet trains, GRO will aggregate packets so we do not get a per-packet benefit.
Header prediction will also break down with light packet loss due to SACK.

So, In short: What do others think?

Florian Westphal (6):
tcp: remove prequeue support
tcp: reindent two spots after prequeue removal
tcp: remove low_latency sysctl
tcp: remove header prediction
tcp: remove CA_ACK_SLOWPATH
tcp: remove unused mib counters

Quoted 16 lines
 Documentation/networking/ip-sysctl.txt |    7
 include/linux/tcp.h                    |   15 -
 include/net/tcp.h                      |   40 ----
 include/uapi/linux/snmp.h              |    8
 net/ipv4/proc.c                        |    8
 net/ipv4/sysctl_net_ipv4.c             |    3
 net/ipv4/tcp.c                         |  109 -----------
 net/ipv4/tcp_input.c                   |  303 +++------------------------------
 net/ipv4/tcp_ipv4.c                    |   63 ------
 net/ipv4/tcp_minisocks.c               |    3
 net/ipv4/tcp_output.c                  |    2
 net/ipv4/tcp_timer.c                   |   12 -
 net/ipv4/tcp_westwood.c                |   31 ---
 net/ipv6/tcp_ipv6.c                    |    3
 14 files changed, 43 insertions(+), 564 deletions(-)

I unconditionally support the removal of prequeue support.

For the header prediction code: IMHO before removing the header prediction code it would be useful to do some kind of before-and-after benchmarking on a low-powered device where battery life is the main concern. I am thinking about ARM-based cell phones, IoT/embedded devices, raspberry pi, etc. You mention GRO helping to make header prediction obsolete, but in those devices packets arrive so slowly that probably GRO does not help. With slow CPUs and battery life the main concern, it seems conceivable to me that header prediction might still be a win (and worth keeping, since the complexity cost is largely in the past; the maintenance overhead has been low). Just a thought.

thanks,
neal

#10 lore raw
Quoted 59 lines · Neal Cardwell
Quoted 39 lines · Florian Westphal

This RFC removes tcp prequeueing and header prediction support.

After a hallway discussion with Eric Dumazet some maybe-not-so-useful-anymore TCP stack features came up, HP and Prequeue among these.

So this RFC proposes to axe both.

In brief, TCP prequeue assumes a single-process-blocking-read design, which is not that common anymore, and the most frequently used high-performance networking program that does this is netperf :)

With more commong (e)poll designs, prequeue doesn't work.

The idea behind prequeueing isn't so bad in itself; it moves part of tcp processing -- including ack processing (including retransmit queue processing) into process context. However, removing it would not just avoid some code, for most programs it elimiates dead code.

As processing then always occurs in BH context, it would allow us to experiment e.g. with bulk-freeing of skb heads when a packet acks data on the retransmit queue.

Header prediction is also less useful nowadays.
For packet trains, GRO will aggregate packets so we do not get a per-packet benefit.
Header prediction will also break down with light packet loss due to SACK.

So, In short: What do others think?

Florian Westphal (6):
tcp: remove prequeue support
tcp: reindent two spots after prequeue removal
tcp: remove low_latency sysctl
tcp: remove header prediction
tcp: remove CA_ACK_SLOWPATH
tcp: remove unused mib counters

Quoted 16 lines
 Documentation/networking/ip-sysctl.txt |    7
 include/linux/tcp.h                    |   15 -
 include/net/tcp.h                      |   40 ----
 include/uapi/linux/snmp.h              |    8
 net/ipv4/proc.c                        |    8
 net/ipv4/sysctl_net_ipv4.c             |    3
 net/ipv4/tcp.c                         |  109 -----------
 net/ipv4/tcp_input.c                   |  303 +++------------------------------
 net/ipv4/tcp_ipv4.c                    |   63 ------
 net/ipv4/tcp_minisocks.c               |    3
 net/ipv4/tcp_output.c                  |    2
 net/ipv4/tcp_timer.c                   |   12 -
 net/ipv4/tcp_westwood.c                |   31 ---
 net/ipv6/tcp_ipv6.c                    |    3
 14 files changed, 43 insertions(+), 564 deletions(-)

I unconditionally support the removal of prequeue support.

Quoted 9 lines

For the header prediction code: IMHO before removing the header prediction code it would be useful to do some kind of before-and-after benchmarking on a low-powered device where battery life is the main concern. I am thinking about ARM-based cell phones, IoT/embedded devices, raspberry pi, etc. You mention GRO helping to make header prediction obsolete, but in those devices packets arrive so slowly that probably GRO does not help. With slow CPUs and battery life the main concern, it seems conceivable to me that header prediction might still be a win (and worth keeping, since the complexity cost is

by the time these devices use 4.12 kernels they are likely powerful enough to make header prediction irrelevant...

Quoted 5 lines

largely in the past; the maintenance overhead has been low). Just a thought.

thanks,
neal

#11 lore raw
Quoted 2 lines · Yuchung Cheng

by the time these devices use 4.12 kernels they are likely powerful enough to make header prediction irrelevant...

Also note that TCP stack complexity has increased a lot, I seriously doubt anyone could notice any difference.

On small devices, the major cost is the wakeup of the cpu to process one frame before going back to idle...

maintainer
#12 lore raw

From: Eric Dumazet <[email protected]>
Date: Mon, 31 Jul 2017 13:22:22 -0700

Quoted 9 lines · Yuchung Cheng
Quoted 2 lines

by the time these devices use 4.12 kernels they are likely powerful enough to make header prediction irrelevant...

Also note that TCP stack complexity has increased a lot, I seriously doubt anyone could notice any difference.

On small devices, the major cost is the wakeup of the cpu to process one frame before going back to idle...

I agree with Yuchung and Eric on all counts.