Skip to contentSkip to conversation

Current 2.6.x TSO state

DISCUSSION David S. Miller 4 participants 12 messages Oct 1, 2004 – Oct 3, 2004

Subsystems (2)
lore
Share & tools
lore

David S. Miller

author maintainer
#0 lore raw

Attached are the 4 TCP TSO patches I have in my tree. They are relative to Linus's current tree and also available at:

	bk://kernel.bkbits.net/davem/net-2.6

The quick summary is:

diff1) Smooth out TSO ack clocking by calling
tcp_trim_head() at tcp_tso_ack() time
and making tcp_trim_head() liberate
socket send buffer space.

diff2) URG fix in tcp_tso_ack()

diff3) Add tcp_tso_win_divisor sysctl knob.

diff4) Obey MSS in tso handling, shrink tcp_skb_cb

Existing known problems requiring a fix in
time for 2.6.9-final are:

1) Andi sees performance anomaly to 2.6.5 kernels. Hopefully fixed by diff3 above, merely awaiting retesting by him.

2) John Heffner sees some kind of weird transfer
hang, down/up'ing the interface makes transfer
finish successfully.

He has told me he will spend some time this weekend trying to debug it.

Future enhancements which are not as critical as
the above:

1) Handle SACK tagging of TSO frames... somehow.
I don't have any brilliant ideas currently.

We could use bits, to represent sub-TSO SACK
regions. This would impose a hard limit of
something like 32 for the maximum TSO factor.

Another idea is to resegment a TSO frame when
SACKs cover portions. This approach is my
least favorite because SACKs can be common in
the presence of even minor packet reordering.
So we'd be splitting up + copying a lot.

2) Leave TSO enabled even during loss events.
#1 is pretty much a prerequisite for #2

If we don't do #1 first, most SACKs get entirely ignored.

3) Fix up the packet counting once we have sub-TSO SACK tagging in place.

Ok that's enough TSO hacking for me today.

#1 lore raw
Quoted 4 lines · On Thu, 30 Sep 2004 21:32:21 -0700 "David S. Miller" <[email protected]>…

1) Andi sees performance anomaly to 2.6.5 kernels. Hopefully fixed by diff3 above, merely awaiting retesting by him.

Didn't fix the problem unfortunately, it's even a bit slower with TSO than the previous kernel I tested.

The stretch acks are still quite visible, see
http://www.firstfloor.org/~andi/tso-stretch-ack1.gz for the full log.

I will try to do the ACK instrumentation on the receiver you suggested later, unfortunately have some other urgent things to do first.

Do you want me to play with the new sysctl too?

tcptrace output for the last run as overview:

      complete conn: yes
        first packet:  Fri Oct  1 12:02:39.725840 2004
        last packet:   Fri Oct  1 12:02:49.729142 2004
        elapsed time:  0:00:10.003302
        total packets: 315102
        filename:      /tmp/LOG
   e->f:                              f->e:
     total packets:        298495           total packets:         16607      
     ack pkts sent:        298494           ack pkts sent:         16607      
     pure acks sent:            2           pure acks sent:        16605      
     unique bytes sent: 432215424           unique bytes sent:         0      
     actual data pkts:     298492           actual data pkts:          0      
     actual data bytes: 432215424           actual data bytes:         0      
     rexmt data pkts:           0           rexmt data pkts:           0      
     rexmt data bytes:          0           rexmt data bytes:          0      
     outoforder pkts:           0           outoforder pkts:           0      
     pushed data pkts:      16715           pushed data pkts:          0      
     SYN/FIN pkts sent:       1/1           SYN/FIN pkts sent:       1/1      
     req 1323 ws/ts:          Y/Y           req 1323 ws/ts:          Y/Y      
     adv wind scale:            2           adv wind scale:            0      
     req sack:                  Y           req sack:                  Y      
     sacks sent:                0           sacks sent:                0      
     mss requested:          1460 bytes     mss requested:          1460 bytes
     max segm size:          1448 bytes     max segm size:             0 bytes
     min segm size:           456 bytes     min segm size:             0 bytes
     avg segm size:          1447 bytes     avg segm size:             0 bytes
     max win adv:            5840 bytes     max win adv:           63712 bytes
     min win adv:            5840 bytes     min win adv:            5792 bytes
     zero win adv:              0 times     zero win adv:              0 times
     avg win adv:            5840 bytes     avg win adv:           63673 bytes
     initial window:         4344 bytes     initial window:            0 bytes
     initial window:            3 pkts      initial window:            0 pkts 
     ttl stream length: 432215424 bytes     ttl stream length:         0 bytes
     missed data:               0 bytes     missed data:               0 bytes
     truncated data:    423260664 bytes     truncated data:            0 bytes
     truncated packets:    298492 pkts      truncated packets:         0 pkts 
     data xmit time:       10.003 secs      data xmit time:        0.000 secs 
     idletime max:            8.4 ms        idletime max:            8.6 ms   
     throughput:         43207275 Bps       throughput:                0 Bps  

No SACKs etc.

-Andi

author maintainer
#2 lore raw
Quoted 1 line · On Fri, 1 Oct 2004 12:11:23 +0200 Andi Kleen <[email protected]> wrote:

Do you want me to play with the new sysctl too?

Yes.

Quoted 2 lines
     max win adv:            5840 bytes     max win adv:           63712 bytes
     min win adv:            5840 bytes     min win adv:            5792 bytes

That stinks that the receiver is only using a 64K window, that's way too small for gigabit.

#3 lore raw
Quoted 6 lines · David S. Miller
Quoted 1 line · On Fri, 1 Oct 2004 12:11:23 +0200 Andi Kleen <[email protected]> wrote:

Do you want me to play with the new sysctl too?

Yes.

Already did, see my other mail (I should not read incoming mail in the wrong order @)

Quoted 6 lines
Quoted 3 lines
     max win adv:            5840 bytes     max win adv:           63712 bytes
     min win adv:            5840 bytes     min win adv:            5792 bytes

That stinks that the receiver is only using a 64K window, that's way too small for gigabit.

Just using the default, no tuning.

I have some patches in the pipeline to do automatic window tuning based on link speed based on dev->features. But they were actually more intended for 10Gbit/s (where all the defaults are completely inadequate) And it needs a bit more work.

-Andi

author maintainer
#4 lore raw
Quoted 6 lines · On Fri, 1 Oct 2004 21:51:47 +0200 Andi Kleen <[email protected]> wrote:
Quoted 5 lines
Quoted 2 lines
     max win adv:            5840 bytes     max win adv:           63712 bytes
     min win adv:            5840 bytes     min win adv:            5792 bytes

That stinks that the receiver is only using a 64K window, that's way too small for gigabit.

Quoted 6 lines

Just using the default, no tuning.

I have some patches in the pipeline to do automatic window tuning based on link speed based on dev->features. But they were actually more intended for 10Gbit/s (where all the defaults are completely inadequate) And it needs a bit more work.

As mentioned, the TCP receive buffer auto-tuning takes care of all of this in 2.6.6 and later. It's just 2.6.5 doesn't have John Heffner's auto-tuning code which is why your test case is so stuck in the mud.

Also, the stretch ACK's are quite normal. If the receiver can't advertize a larger window, we won't spit out an ACK until the ack timeout.

#5 lore raw
Quoted 8 lines

As mentioned, the TCP receive buffer auto-tuning takes care of all of this in 2.6.6 and later. It's just 2.6.5 doesn't have John Heffner's auto-tuning code which is why your test case is so stuck in the mud.

Also, the stretch ACK's are quite normal. If the receiver can't advertize a larger window, we won't spit out an ACK until the ack timeout.

Ok, but why is the TSO case still slower?

-Andi

author maintainer
#6 lore raw
Quoted 10 lines · On Fri, 1 Oct 2004 22:01:02 +0200 Andi Kleen <[email protected]> wrote:
Quoted 8 lines

As mentioned, the TCP receive buffer auto-tuning takes care of all of this in 2.6.6 and later. It's just 2.6.5 doesn't have John Heffner's auto-tuning code which is why your test case is so stuck in the mud.

Also, the stretch ACK's are quite normal. If the receiver can't advertize a larger window, we won't spit out an ACK until the ack timeout.

Ok, but why is the TSO case still slower?

It isn't for me. With the auto-tuning code present at the receiver, at least in my case, the TSO case runs more quickly since my sender is PCI bandwidth limited since the tg3 sits on a 32mhz/33bit PCI bus.

#7 lore raw
In reply to Andi Kleen
Quoted 10 lines · Andi Kleen
Quoted 8 lines

As mentioned, the TCP receive buffer auto-tuning takes care of all of this in 2.6.6 and later. It's just 2.6.5 doesn't have John Heffner's auto-tuning code which is why your test case is so stuck in the mud.

Also, the stretch ACK's are quite normal. If the receiver can't advertize a larger window, we won't spit out an ACK until the ack timeout.

Ok, but why is the TSO case still slower?

Because with TSO enabled, you get bigger back-to-back bursts during which the receiving app can't run.

-John

#8 lore raw
In reply to David S. Miller
Quoted 2 lines

As mentioned, the TCP receive buffer auto-tuning takes care of all of this in 2.6.6 and later. It's just 2.6.5 doesn't

How do you explain the 2-4MB/s less with manually increased receive buffers?

-Andi

author maintainer
#9 lore raw
Quoted 5 lines · On Sat, 2 Oct 2004 01:19:39 +0200 Andi Kleen <[email protected]> wrote:
Quoted 2 lines

As mentioned, the TCP receive buffer auto-tuning takes care of all of this in 2.6.6 and later. It's just 2.6.5 doesn't

How do you explain the 2-4MB/s less with manually increased receive buffers?

Some scheduling differences, I suppose.

Frankly, I've done what I can with the TSO stuff at this point.

All I get from you are "it's slower" and no code, I've had to write and fix and debug everything for you. The performance is close or on-par to non-TSO and more importantly TSO abides by the congestion window and MSS values properly now. That's 10 times more important than 2-4MB/s performance difference.

Or maybe I should revert all of the TSO work so that all SpecWEB submissions done with 2.6.x kernels get invalidated?

#10 lore raw
In reply to David S. Miller
Quoted 2 lines · David S. Miller

diff4) Obey MSS in tso handling, shrink tcp_skb_cb

This looks great. But can we please rename tcp_skb_psize to tcp_skb_mss?

Thanks,

Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
author maintainer
#11 lore raw
Quoted 6 lines · On Fri, 1 Oct 2004 23:06:09 +1000 Herbert Xu <[email protected]>…
Quoted 2 lines · David S. Miller

diff4) Obey MSS in tso handling, shrink tcp_skb_cb

This looks great. But can we please rename tcp_skb_psize to tcp_skb_mss?

Sure, no problem, I've done that in my tree.