diff options
author | Eric Dumazet <dada1@cosmosbay.com> | 2007-12-21 00:48:32 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 17:59:41 -0500 |
commit | b92edbe0b8a36a833c16b0cbafb6e899b81ffc08 (patch) | |
tree | 0d5376e9835ebfa06eb9d7f78569c1f1aeb7a301 | |
parent | 68277accb3a5f004344f4346498640601b8b7016 (diff) |
[TCP] Avoid two divides in tcp_output.c
Because 'free_space' variable in __tcp_select_window() is signed,
expression (free_space / 2) forces compiler to emit an integer divide.
This can be changed to a plain right shift, less expensive.
Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/ipv4/tcp_output.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 7c50271ddc30..9a9510acb147 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -1627,7 +1627,7 @@ u32 __tcp_select_window(struct sock *sk) | |||
1627 | if (mss > full_space) | 1627 | if (mss > full_space) |
1628 | mss = full_space; | 1628 | mss = full_space; |
1629 | 1629 | ||
1630 | if (free_space < full_space/2) { | 1630 | if (free_space < (full_space >> 1)) { |
1631 | icsk->icsk_ack.quick = 0; | 1631 | icsk->icsk_ack.quick = 0; |
1632 | 1632 | ||
1633 | if (tcp_memory_pressure) | 1633 | if (tcp_memory_pressure) |
@@ -1666,7 +1666,7 @@ u32 __tcp_select_window(struct sock *sk) | |||
1666 | if (window <= free_space - mss || window > free_space) | 1666 | if (window <= free_space - mss || window > free_space) |
1667 | window = (free_space/mss)*mss; | 1667 | window = (free_space/mss)*mss; |
1668 | else if (mss == full_space && | 1668 | else if (mss == full_space && |
1669 | free_space > window + full_space/2) | 1669 | free_space > window + (full_space >> 1)) |
1670 | window = free_space; | 1670 | window = free_space; |
1671 | } | 1671 | } |
1672 | 1672 | ||