提交 b92edbe0 编写于 作者: E Eric Dumazet 提交者: David S. Miller

[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: NEric Dumazet <dada1@cosmosbay.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 68277acc
......@@ -1627,7 +1627,7 @@ u32 __tcp_select_window(struct sock *sk)
if (mss > full_space)
mss = full_space;
if (free_space < full_space/2) {
if (free_space < (full_space >> 1)) {
icsk->icsk_ack.quick = 0;
if (tcp_memory_pressure)
......@@ -1666,7 +1666,7 @@ u32 __tcp_select_window(struct sock *sk)
if (window <= free_space - mss || window > free_space)
window = (free_space/mss)*mss;
else if (mss == full_space &&
free_space > window + full_space/2)
free_space > window + (full_space >> 1))
window = free_space;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册