tcp: detect loss above high_seq in recovery
Subsystems (3)
PATCH 1/1 tcp: detect loss above high_seq in recovery
Correctly implement a loss detection heuristic: New sequences (above high_seq) sent during the fast recovery are deemed lost when higher sequences are SACKed.
Current code does not catch these losses, because tcp_mark_head_lost() does not check packets beyond high_seq. The fix is straight-forward by checking packets until the highest sacked packet. In addition, all the FLAG_DATA_LOST logic are in-effective and redundant and can be removed.
The new sequences sent during fast-recovery maybe marked as lost and/or retransmitted. It is possible these (new) losses are recovered within the current fast recovery and the state moves back to CA_Open without entering another fast recovery / cwnd redunction. This is especially possible for light losses. Note RFC 3517 (implicitly) allows this as well.
Update the loss heuristic comments. The algorithm above is documented as heuristic B, but it is redundant too because heuristic A already covers B.
--- include/linux/snmp.h | 1 - net/ipv4/proc.c | 1 - net/ipv4/tcp_input.c | 41 +++++++++++++++-------------------------- 3 files changed, 15 insertions(+), 28 deletions(-)
include/linux/snmp.h +0 -1
@@ -192,7 +192,6 @@ enumLINUX_MIB_TCPPARTIALUNDO ,/* TCPPartialUndo */ LINUX_MIB_TCPDSACKUNDO ,/* TCPDSACKUndo */ LINUX_MIB_TCPLOSSUNDO ,/* TCPLossUndo */ -LINUX_MIB_TCPLOSS ,/* TCPLoss */ LINUX_MIB_TCPLOSTRETRANSMIT ,/* TCPLostRetransmit */ LINUX_MIB_TCPRENOFAILURES ,/* TCPRenoFailures */ LINUX_MIB_TCPSACKFAILURES, /* TCPSackFailures */
net/ipv4/proc.c +0 -1
@@ -216,7 +216,6 @@ static const struct snmp_mib snmp4_net_list[] = {SNMP_MIB_ITEM ("TCPPartialUndo" ,LINUX_MIB_TCPPARTIALUNDO ),SNMP_MIB_ITEM ("TCPDSACKUndo" ,LINUX_MIB_TCPDSACKUNDO ),SNMP_MIB_ITEM ("TCPLossUndo" ,LINUX_MIB_TCPLOSSUNDO ), -SNMP_MIB_ITEM ("TCPLoss" ,LINUX_MIB_TCPLOSS ),SNMP_MIB_ITEM ("TCPLostRetransmit" ,LINUX_MIB_TCPLOSTRETRANSMIT ),SNMP_MIB_ITEM ("TCPRenoFailures" ,LINUX_MIB_TCPRENOFAILURES ), SNMP_MIB_ITEM("TCPSackFailures", LINUX_MIB_TCPSACKFAILURES),
net/ipv4/tcp_input.c +15 -26
99 lines not on this page · raw message
Signature · 1 line
1.7.3.1
Quoted 8 lines · Yuchung Cheng
Correctly implement a loss detection heuristic: New sequences (above
high_seq) sent during the fast recovery are deemed lost when higher sequences are SACKed.Current code does not catch these losses, because
tcp_mark_head_lost()does not check packets beyondhigh_seq. The fix is straight-forward by checking packets until the highest sacked packet. In addition, all theFLAG_DATA_LOSTlogic are in-effective and redundant and can be removed.
I agree that FLAG_DATA_LOST never did anything very useful... I've never figure out why it was there (perhaps some earlier change made it broken or so before I've been tracking TCP dev).
Quoted 6 lines
The new sequences sent during fast-recovery maybe marked as lost and/or retransmitted. It is possible these (new) losses are recovered within the current fast recovery and the state moves back to
CA_Openwithout entering another fast recovery / cwnd redunction. This is especially possible for light losses. Note RFC 3517 (implicitly) allows this as well.
No it doesn't! It does not allow you to avoid the second cwnd reduction. They're from different RTT. What you now claim is that we never need to do cwnd reduction until we visit CA_Open in between. That's very very dangerous if the congestion suddently spikes because nobody reduces twice causing everyone to get losses and continues in the recovery forever.
Quoted 28 lines
Update the loss heuristic comments. The algorithm above is documented as heuristic B, but it is redundant too because heuristic A already covers B.
Signed-off-by Yuchung Cheng <[email protected]>--- include/linux/snmp.h | 1 - net/ipv4/proc.c | 1 - net/ipv4/tcp_input.c | 41 +++++++++++++++-------------------------- 3 files changed, 15 insertions(+), 28 deletions(-)include/linux/snmp.h +0
-1@@ -192,7 +192,6 @@ enumLINUX_MIB_TCPPARTIALUNDO ,/* TCPPartialUndo */ LINUX_MIB_TCPDSACKUNDO ,/* TCPDSACKUndo */ LINUX_MIB_TCPLOSSUNDO ,/* TCPLossUndo */ -LINUX_MIB_TCPLOSS ,/* TCPLoss */ LINUX_MIB_TCPLOSTRETRANSMIT ,/* TCPLostRetransmit */ LINUX_MIB_TCPRENOFAILURES ,/* TCPRenoFailures */ LINUX_MIB_TCPSACKFAILURES, /* TCPSackFailures */net/ipv4/proc.c +0
-0
net/ipv4/proc.c static const struct snmp_mib snmp4_net_list[] = { · line 219
Quoted 4 lines
net/ipv4/proc.c +0
-1@@ -216,7 +216,6 @@ static const struct snmp_mib snmp4_net_list[] = {SNMP_MIB_ITEM ("TCPPartialUndo" ,LINUX_MIB_TCPPARTIALUNDO ),SNMP_MIB_ITEM ("TCPDSACKUndo" ,LINUX_MIB_TCPDSACKUNDO ), SNMP_MIB_ITEM("TCPLossUndo", LINUX_MIB_TCPLOSSUNDO), - SNMP_MIB_ITEM("TCPLoss", LINUX_MIB_TCPLOSS),
I don't think you can remove MIBs as they're userspace visible.
Signature · 1 line
i.
David Miller
maintainerFrom: "Ilpo Järvinen" <[email protected]>
Date: Wed, 28 Dec 2011 17:42:06 +0200 (EET)
Quoted 1 line
I don't think you can remove MIBs as they're userspace visible.
Because of how they are implemented and how applications use them, this is actually allowed.
All the MIBs are presented first as a series of strings, then as a series of values.
So applications parse them both to report the statistics, and this do get coded in a way that they do not need to assume the presence or particular ordering of these MIBS.
Therefore, such a change is safe.
Ilpo,
Quoted 9 lines · Ilpo Järvinen
Quoted 6 lines · Yuchung Cheng
The new sequences sent during fast-recovery maybe marked as lost and/or retransmitted. It is possible these (new) losses are recovered within the current fast recovery and the state moves back to
CA_Openwithout entering another fast recovery / cwnd redunction. This is especially possible for light losses. Note RFC 3517 (implicitly) allows this as well.
Quoted 5 lines
No it doesn't! It does not allow you to avoid the second cwnd reduction. They're from different RTT. What you now claim is that we never need to do cwnd reduction until we visit
CA_Openin between. That's very very dangerous if the congestion suddently spikes because nobody reduces twice causing everyone to get losses and continues in the recovery forever.
Should TCP perform another CWR for sequences lost after recovery point? my colleagues and I all agree with you it should. But my commit message did a poor job explain some subtle deviations in standard and current Linux.
RFC3517 supports this by principle; however, it may repair such new data losses in the current recovery: Rue 1.b and 1.c in NextSeg() allow retransmitting any segment below highest sacked sequence. Thus it may repair every loss in the current recovery and won't never go into another.
As a matter of fact, Linux already does that today, by implementing rule 3 in NextSeg(), aka forward-retransmit. But Linux won't mark these packets lost even if there are >= tp->reordering packets sacked above. This change fixes this.
How often is second CWR avoided? it's probably rare b/c it requires new data during the recovery RTT and a complete repair any losses of them. It's arguably
OK to fix small new data losses during current recovery, and RFC/Linux seem
to do so.
To summarize:
1) this change does NOT forbid TCP performing further CWR on new losses
2) this change (merely) marks some forward-retransmitted packets LOST.
3) the commit message is to be explicit that CWR may not always be performed, in both my change and current kernel.
HTH. I will update commit message if people can make sense of it :)
Quoted 12 lines · Yuchung Cheng
Ilpo,
Quoted 9 lines · Ilpo Järvinen
Quoted 6 lines · Yuchung Cheng
The new sequences sent during fast-recovery maybe marked as lost and/or retransmitted. It is possible these (new) losses are recovered within the current fast recovery and the state moves back to
CA_Openwithout entering another fast recovery / cwnd redunction. This is especially possible for light losses. Note RFC 3517 (implicitly) allows this as well.
Quoted 8 lines
Quoted 5 lines
No it doesn't! It does not allow you to avoid the second cwnd reduction. They're from different RTT. What you now claim is that we never need to do cwnd reduction until we visit
CA_Openin between. That's very very dangerous if the congestion suddently spikes because nobody reduces twice causing everyone to get losses and continues in the recovery forever.Should TCP perform another CWR for sequences lost after recovery point? my colleagues and I all agree with you it should.
I agree, and it seems that neither Linux nor RFC3517 does this right (I should have read the RFC more carefully instead just trust my own guesswork. It seems that there's instead this corner case not covered in the RFC correctly, probably because it would require rexmit loss that forces RTO with standard TCP or reordering).
Quoted 2 lines
But my commit message did a poor job explain some subtle deviations in standard and current Linux.
Right, I though you're changing (removing) the second reduction based on the commit message as I didn't have time to go through enough code. But it seems that it is pre-existing issue.
Quoted 5 lines
RFC3517 supports this by principle; however, it may repair such new data losses in the current recovery: Rue 1.b and 1.c in
NextSeg()allow retransmitting any segment below highest sacked sequence. Thus it may repair every loss in the current recovery and won't never go into another.
I suppose we should be moving high_seq (RecoveryPoint) to the snd_nxt when we retransmit something above high_seq and initiate the addition reduction using PRR. It won't be accurately measuring the next RTT though as rexmits and new data were mixed during the first recovery RTT but I suppose it's still good enough approximation.
Quoted 4 lines
As a matter of fact, Linux already does that today, by implementing rule 3 in
NextSeg(), aka forward-retransmit. But Linux won't mark these packets lost even if there are >=tp->reorderingpackets sacked above. This change fixes this.
I was thinking there used to be seq < high_seq condition in the rexmit loop but it seems that it either got dropped or I remember wrong. That would have prevented forward rexmits past the boundary.
Quoted 4 lines
How often is second CWR avoided? it's probably rare b/c it requires new data during the recovery RTT and a complete repair any losses of them. It's arguably OK to fix small new data losses during current recovery, and RFC/Linux seem to do so.
There's one significant difference here: For RFC this is includes only some trivial reordering cases, but with Linux we can handle lost rexmits, making it more likely to happen (they would require RTO & its consequences with RFC/Std TCP if we assume no reordering cumulative ACKs end the previous recovery and the next one immediately gets triggered).
Quoted 5 lines
To summarize:
1) this change does NOT forbid TCP performing further CWR on new losses
2) this change (merely) marks some forward-retransmitted packets LOST.
3) the commit message is to be explicit that CWR may not always be performed, in both my change and current kernel.
I agree with these points. I wonder if you intend to look to fixing the lacking CWR problem or should I look to that once I get some spare time?
Quoted 1 line
HTH. I will update commit message if people can make sense of it :)
Please do.
Signature · 1 line
i.
Quoted 8 lines · Ilpo Järvinen
Quoted 5 lines · Yuchung Cheng
To summarize:
1) this change does NOT forbid TCP performing further CWR on new losses
2) this change (merely) marks some forward-retransmitted packets LOST.
3) the commit message is to be explicit that CWR may not always be performed, in both my change and current kernel.
Quoted 6 lines
I agree with these points. I wonder if you intend to look to fixing the lacking CWR problem or should I look to that once I get some spare time?
Quoted 1 line
HTH. I will update commit message if people can make sense of it :)
Please do.
Great, I'll update the commit message first, and work on another feature patch that does CWR if
a) new sequence is lost
b) a retransmission is lost
Quoted 13 lines · Yuchung Cheng
Quoted 11 lines · Ilpo Järvinen
Quoted 5 lines · Yuchung Cheng
To summarize:
1) this change does NOT forbid TCP performing further CWR on new losses
2) this change (merely) marks some forward-retransmitted packets LOST.
3) the commit message is to be explicit that CWR may not always be performed, in both my change and current kernel.I agree with these points. I wonder if you intend to look to fixing the lacking CWR problem or should I look to that once I get some spare time?
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
HTH. I will update commit message if people can make sense of it :)
Please do.
Great, I'll update the commit message first, and work on another feature patch that does CWR if
a) new sequence is lost
b) a retransmission is lost
Ok, thanks. I think that it's better to do the way you suggest... ie., to do the cwr on detection rather than (possibly much) later when rexmitting.
Signature · 1 line
i.