This is a note to let you know that I've just added the patch titled tcp: tsq: restore minimal amount of queueing to the 3.12-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: tcp-tsq-restore-minimal-amount-of-queueing.patch and it can be found in the queue-3.12 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From foo@baz Thu Dec 5 16:16:38 PST 2013 From: Eric Dumazet <edumazet@xxxxxxxxxx> Date: Wed, 13 Nov 2013 06:32:54 -0800 Subject: tcp: tsq: restore minimal amount of queueing From: Eric Dumazet <edumazet@xxxxxxxxxx> [ Upstream commit 98e09386c0ef4dfd48af7ba60ff908f0d525cdee ] After commit c9eeec26e32e ("tcp: TSQ can use a dynamic limit"), several users reported throughput regressions, notably on mvneta and wifi adapters. 802.11 AMPDU requires a fair amount of queueing to be effective. This patch partially reverts the change done in tcp_write_xmit() so that the minimal amount is sysctl_tcp_limit_output_bytes. It also remove the use of this sysctl while building skb stored in write queue, as TSO autosizing does the right thing anyway. Users with well behaving NICS and correct qdisc (like sch_fq), can then lower the default sysctl_tcp_limit_output_bytes value from 128KB to 8KB. This new usage of sysctl_tcp_limit_output_bytes permits each driver authors to check how their driver performs when/if the value is set to a minimum of 4KB. Normally, line rate for a single TCP flow should be possible, but some drivers rely on timers to perform TX completion and too long TX completion delays prevent reaching full throughput. Fixes: c9eeec26e32e ("tcp: TSQ can use a dynamic limit") Signed-off-by: Eric Dumazet <edumazet@xxxxxxxxxx> Reported-by: Sujith Manoharan <sujith@xxxxxxxxxxx> Reported-by: Arnaud Ebalard <arno@xxxxxxxxxxxx> Tested-by: Sujith Manoharan <sujith@xxxxxxxxxxx> Cc: Felix Fietkau <nbd@xxxxxxxxxxx> Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- Documentation/networking/ip-sysctl.txt | 3 --- net/ipv4/tcp.c | 6 ------ net/ipv4/tcp_output.c | 6 +++++- 3 files changed, 5 insertions(+), 10 deletions(-) --- a/Documentation/networking/ip-sysctl.txt +++ b/Documentation/networking/ip-sysctl.txt @@ -588,9 +588,6 @@ tcp_limit_output_bytes - INTEGER typical pfifo_fast qdiscs. tcp_limit_output_bytes limits the number of bytes on qdisc or device to reduce artificial RTT/cwnd and reduce bufferbloat. - Note: For GSO/TSO enabled flows, we try to have at least two - packets in flight. Reducing tcp_limit_output_bytes might also - reduce the size of individual GSO packet (64KB being the max) Default: 131072 tcp_challenge_ack_limit - INTEGER --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -806,12 +806,6 @@ static unsigned int tcp_xmit_size_goal(s xmit_size_goal = min_t(u32, gso_size, sk->sk_gso_max_size - 1 - hlen); - /* TSQ : try to have at least two segments in flight - * (one in NIC TX ring, another in Qdisc) - */ - xmit_size_goal = min_t(u32, xmit_size_goal, - sysctl_tcp_limit_output_bytes >> 1); - xmit_size_goal = tcp_bound_to_half_wnd(tp, xmit_size_goal); /* We try hard to avoid divides here */ --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -1875,8 +1875,12 @@ static bool tcp_write_xmit(struct sock * * - better RTT estimation and ACK scheduling * - faster recovery * - high rates + * Alas, some drivers / subsystems require a fair amount + * of queued bytes to ensure line rate. + * One example is wifi aggregation (802.11 AMPDU) */ - limit = max(skb->truesize, sk->sk_pacing_rate >> 10); + limit = max_t(unsigned int, sysctl_tcp_limit_output_bytes, + sk->sk_pacing_rate >> 10); if (atomic_read(&sk->sk_wmem_alloc) > limit) { set_bit(TSQ_THROTTLED, &tp->tsq_flags); Patches currently in stable-queue which might be from edumazet@xxxxxxxxxx are queue-3.12/net-8139cp-fix-a-bug_on-triggered-by-wrong-bytes_compl.patch queue-3.12/sch_tbf-handle-too-small-burst.patch queue-3.12/gro-only-verify-tcp-checksums-for-candidates.patch queue-3.12/net-tcp-fix-panic-in-tcp_fastopen_cache_set.patch queue-3.12/tcp-tsq-restore-minimal-amount-of-queueing.patch queue-3.12/pkt_sched-fq-fix-pacing-for-small-frames.patch queue-3.12/ipv6-fix-possible-seqlock-deadlock-in-ip6_finish_output2.patch queue-3.12/tcp-don-t-update-snd_nxt-when-a-socket-is-switched-from-repair-mode.patch queue-3.12/inet-fix-possible-seqlock-deadlocks.patch queue-3.12/net-x86-bpf-don-t-forget-to-free-sk_filter-v2.patch queue-3.12/sit-fix-use-after-free-of-fb_tunnel_dev.patch queue-3.12/net-clamp-msg_namelen-instead-of-returning-an-error.patch queue-3.12/af_packet-block-bh-in-prb_shutdown_retire_blk_timer.patch queue-3.12/pkt_sched-fq-change-classification-of-control.patch queue-3.12/pkt_sched-fq-warn-users-using-defrate.patch queue-3.12/gro-clean-up-tcpx_gro_receive-checksum-verification.patch queue-3.12/ipv4-fix-possible-seqlock-deadlock.patch queue-3.12/gso-handle-new-frag_list-of-frags-gro-packets.patch -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html