Skip to content

Commit

Permalink
tcp: do not slow start when cwnd equals ssthresh
Browse files Browse the repository at this point in the history
In the original design slow start is only used to raise cwnd
when cwnd is stricly below ssthresh. It makes little sense
to slow start when cwnd == ssthresh: especially
when hystart has set ssthresh in the initial ramp, or after
recovery when cwnd resets to ssthresh. Not doing so will
also help reduce the buffer bloat slightly.

Signed-off-by: Yuchung Cheng <[email protected]>
Signed-off-by: Neal Cardwell <[email protected]>
Signed-off-by: Eric Dumazet <[email protected]>
Signed-off-by: Nandita Dukkipati <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
yuchungcheng authored and davem330 committed Jul 9, 2015
1 parent 071d508 commit 7617400
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion include/net/tcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -991,7 +991,7 @@ static inline unsigned int tcp_packets_in_flight(const struct tcp_sock *tp)

static inline bool tcp_in_slow_start(const struct tcp_sock *tp)
{
return tp->snd_cwnd <= tp->snd_ssthresh;
return tp->snd_cwnd < tp->snd_ssthresh;
}

static inline bool tcp_in_initial_slowstart(const struct tcp_sock *tp)
Expand Down
2 changes: 1 addition & 1 deletion net/ipv4/tcp_cdg.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ static void tcp_cdg_cong_avoid(struct sock *sk, u32 ack, u32 acked)
u32 prior_snd_cwnd;
u32 incr;

if (tp->snd_cwnd < tp->snd_ssthresh && hystart_detect)
if (tcp_in_slow_start(tp) && hystart_detect)
tcp_cdg_hystart_update(sk);

if (after(ack, ca->rtt_seq) && ca->rtt.v64) {
Expand Down
4 changes: 1 addition & 3 deletions net/ipv4/tcp_cong.c
Original file line number Diff line number Diff line change
Expand Up @@ -365,10 +365,8 @@ int tcp_set_congestion_control(struct sock *sk, const char *name)
*/
u32 tcp_slow_start(struct tcp_sock *tp, u32 acked)
{
u32 cwnd = tp->snd_cwnd + acked;
u32 cwnd = min(tp->snd_cwnd + acked, tp->snd_ssthresh);

if (cwnd > tp->snd_ssthresh)
cwnd = tp->snd_ssthresh + 1;
acked -= cwnd - tp->snd_cwnd;
tp->snd_cwnd = min(cwnd, tp->snd_cwnd_clamp);

Expand Down
2 changes: 1 addition & 1 deletion net/ipv4/tcp_hybla.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ static void hybla_cong_avoid(struct sock *sk, u32 ack, u32 acked)

rho_fractions = ca->rho_3ls - (ca->rho << 3);

if (tp->snd_cwnd < tp->snd_ssthresh) {
if (tcp_in_slow_start(tp)) {
/*
* slow start
* INC = 2^RHO - 1
Expand Down

0 comments on commit 7617400

Please sign in to comment.