Messages in this thread Patches in this message | | | Date | Fri, 12 Feb 1999 10:01:33 -0800 | From | (Pete Wyckoff) | Subject | Re: Weird tcp performance differences with 2.0 and 2.2 kernels |
| |
Andi's point about "don't do that if it hurts" is well taken, but Lantz (the original poster) has no bulk transfer option, and doesn't want to wait the extra 20 ms per transfer for no good reason. I've modified the patch so that at least the optimization doesn't hurt us for small transfers as it does now.
In a stock 2.2.1 kernel, the receiving end of the 723-byte transfer is in quickack mode, and has ato = 1 when the data comes in. Then tcp_remember_ack() tries to "help" us by noticing the PSH flag and the small transfer size, so it kills quickack and sets ato = 2. Questionable.
I try to curb that behavior while still allowing the original optimization intended by the routine, in the following patch.
--- stock-2.2.1/net/ipv4/tcp_input.c Fri Jan 22 09:16:09 1999 +++ linux-2.2.1/net/ipv4/tcp_input.c Fri Feb 12 09:36:05 1999 @@ -132,9 +132,21 @@ /* Tiny-grams with PSH set make us ACK quickly. * Note: This also clears the "quick ack mode" bit. + * If this optimization would actually hurt since the + * ato is not bigger than HZ/50, then don't mess with + * anything (including the quickack mode bit). --pw */ - if(th->psh && (skb->len < (tp->mss_cache >> 1))) - tp->ato = HZ/50; + if(th->psh && (skb->len < (tp->mss_cache >> 1))) { + if (tcp_in_quickack_mode(tp)) { + tcp_exit_quickack_mode(tp); + if (tp->ato <= HZ/50) + tcp_enter_quickack_mode(tp); /* do nothing */ + else + tp->ato = HZ/50; /* kill quickack, lower ato */ + } else { + tp->ato = tp->ato < HZ/50 ? tp->ato : HZ/50; + } + } } /* Called to compute a smoothed rtt estimate. The data fed to this
This is a bit more complex, but only affects the one little corner case of single (web-like) transfers in the range 1--723 bytes (on ether), where ato is still smaller than HZ/50. For reference, here's my earlier suggestion which DaveM conceptually approved, and I still favor for its simplicity.
diff -ruN stock-2.2.1/net/ipv4/tcp_input.c linux-2.2.1/net/ipv4/tcp_input.c --- stock-2.2.1/net/ipv4/tcp_input.c Fri Jan 22 09:16:09 1999 +++ linux-2.2.1/net/ipv4/tcp_input.c Thu Feb 11 11:30:59 1999 @@ -132,9 +132,16 @@ /* Tiny-grams with PSH set make us ACK quickly. * Note: This also clears the "quick ack mode" bit. + * Don't clear that bit if it's set already. --pw */ - if(th->psh && (skb->len < (tp->mss_cache >> 1))) - tp->ato = HZ/50; + if(th->psh && (skb->len < (tp->mss_cache >> 1))) { + if (tcp_in_quickack_mode(tp)) { + tp->ato = HZ/50; + tcp_enter_quickack_mode(tp); + } else { + tp->ato = HZ/50; + } + } } /* Called to compute a smoothed rtt estimate. The data fed to this
Dave, I'd like to see the latter patch in the kernel. Both attempt to preserve quickack mode, but the former patch does extra work to ensure it only does so if ato is already quite small (< 20 ms). Both will return with ato <= HZ/50, but the former works hard not to raise the ato. Intuitively I don't see the case happening, so think the latter is sufficient.
-- Pete
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |