tcp: fix tcp_rcv_rtt_update() use of an unscaled RTT sample
Subsystems (3)
Neal Cardwell
maintainerPATCH 1/1 tcp: fix tcp_rcv_rtt_update() use of an unscaled RTT sample
Fix a code path in tcp_rcv_rtt_update() that was comparing scaled and unscaled RTT samples.
The intent in the code was to only use the 'm' measurement if it was a new minimum. However, since 'm' had not yet been shifted left 3 bits but 'new_sample' had, this comparison would nearly always succeed, leading us to erroneously set our receive-side RTT estimate to the 'm' sample when that sample could be nearly 8x too high to use.
The overall effect is to often cause the receive-side RTT estimate to be significantly too large (up to 40% too large for brief periods in my tests).
--- net/ipv4/tcp_input.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-)
net/ipv4/tcp_input.c +5 -2
@@ -474,8 +474,11 @@ static void tcp_rcv_rtt_update(struct tcp_sock *tp, u32 sample, int win_dep)if (!win_dep) { m -= (new_sample >>3 ); new_sample += m; - }else if (m < new_sample) - new_sample = m <<3 ; + }else { + m <<=3 ; +if (m < new_sample) + new_sample = m; + } }else {/* No previous measure. */ new_sample = m <<3 ;
Signature · 1 line
1.7.7.3
Quoted 37 lines · Neal Cardwell
Fix a code path in
tcp_rcv_rtt_update()that was comparing scaled and unscaled RTT samples.The intent in the code was to only use the 'm' measurement if it was a new minimum. However, since 'm' had not yet been shifted left 3 bits but '
new_sample' had, this comparison would nearly always succeed, leading us to erroneously set our receive-side RTT estimate to the 'm' sample when that sample could be nearly 8x too high to use.The overall effect is to often cause the receive-side RTT estimate to be significantly too large (up to 40% too large for brief periods in my tests).
Signed-off-by Neal Cardwell <[email protected]>---
net/ipv4/tcp_input.c | 7 +++++--1 files changed, 5 insertions(+), 2 deletions(-)net/ipv4/tcp_input.c +5
-3@@ -474,8 +474,11 @@ static void tcp_rcv_rtt_update(struct tcp_sock *tp, u32 sample, int win_dep) if (!win_dep) { m -= (new_sample >> 3); new_sample += m; - } else if (m < new_sample) - new_sample = m << 3; + } else { + m <<= 3; + if (m < new_sample) + new_sample = m; + } } else { /* No previous measure. */ new_sample = m << 3; --
Quoted 2 lines
1.7.7.3
From: Neal Cardwell <[email protected]>
Date: Tue, 10 Apr 2012 13:59:20 -0400
Quoted 9 lines
Fix a code path in
tcp_rcv_rtt_update()that was comparing scaled and unscaled RTT samples.The intent in the code was to only use the 'm' measurement if it was a new minimum. However, since 'm' had not yet been shifted left 3 bits but '
new_sample' had, this comparison would nearly always succeed, leading us to erroneously set our receive-side RTT estimate to the 'm' sample when that sample could be nearly 8x too high to use.
Quoted 5 lines
The overall effect is to often cause the receive-side RTT estimate to be significantly too large (up to 40% too large for brief periods in my tests).
Signed-off-by Neal Cardwell <[email protected]>
Applied, thanks.
Quoted 12 lines · David Miller
From: Neal Cardwell <[email protected]>
Date: Tue, 10 Apr 2012 13:59:20 -0400Quoted 9 lines
Fix a code path in
tcp_rcv_rtt_update()that was comparing scaled and unscaled RTT samples.The intent in the code was to only use the 'm' measurement if it was a new minimum. However, since 'm' had not yet been shifted left 3 bits but '
new_sample' had, this comparison would nearly always succeed, leading us to erroneously set our receive-side RTT estimate to the 'm' sample when that sample could be nearly 8x too high to use.
Quoted 8 lines
Quoted 5 lines
The overall effect is to often cause the receive-side RTT estimate to be significantly too large (up to 40% too large for brief periods in my tests).
Signed-off-by Neal Cardwell <[email protected]>Applied, thanks.
--
awesome, is this needed in stable?
Signature · 4 lines
Dave Täht SKYPE: davetaht US Tel: 1-239-829-5608 http://www.bufferbloat.net
David Miller
maintainerFrom: Dave Taht <[email protected]>
Date: Tue, 10 Apr 2012 13:46:38 -0700
Quoted 1 line
awesome, is this needed in stable?
I have it queued up there already.
But you didn't need to write your email at all, you could have checked this yourself:
Quoted 11 lines · David Miller
From: Dave Taht <[email protected]>
Date: Tue, 10 Apr 2012 13:46:38 -0700Quoted 1 line
awesome, is this needed in stable?
I have it queued up there already.
But you didn't need to write your email at all, you could have checked this yourself:
Not sure this URL works (it doesnt for me)
David Miller
maintainerFrom: Eric Dumazet <[email protected]>
Date: Tue, 10 Apr 2012 23:11:34 +0200
Quoted 6 lines · David Miller
Quoted 5 lines
From: Dave Taht <[email protected]>
Date: Tue, 10 Apr 2012 13:46:38 -0700Quoted 1 line
awesome, is this needed in stable?
Quoted 8 lines
Quoted 6 lines
I have it queued up there already.
But you didn't need to write your email at all, you could have checked this yourself:
Not sure this URL works (it doesnt for me)
Sorry, that's my private URL and only works if you're logged in as me :-) This one is better:
Quoted 4 lines · David Miller
Sorry, that's my private URL and only works if you're logged in as me :-) This one is better:
Thanks, added to my bookmarks ;)
Quoted 8 lines · Eric Dumazet
Quoted 4 lines · David Miller
Sorry, that's my private URL and only works if you're logged in as me :-) This one is better:
Thanks, added to my bookmarks ;)
Mine too! I had no idea. Useful.
Is there an emacs interface? :)
Quoted 2 lines
Signature · 4 lines
Dave Täht SKYPE: davetaht US Tel: 1-239-829-5608 http://www.bufferbloat.net