diff options
author | Eric Dumazet <dada1@cosmosbay.com> | 2007-12-21 06:07:53 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 15:00:01 -0800 |
commit | dfd4f0ae2e111e2b93c295938c0e64ebbb69ae6e (patch) | |
tree | 0ce2c35f0ffce2553d897116e9370fdaf0433f12 /net/ipv4/tcp_input.c | |
parent | 8beb5c5f12c8484c59edf9b691f2c4bb4d31f3a0 (diff) | |
download | kernel_samsung_smdk4412-dfd4f0ae2e111e2b93c295938c0e64ebbb69ae6e.zip kernel_samsung_smdk4412-dfd4f0ae2e111e2b93c295938c0e64ebbb69ae6e.tar.gz kernel_samsung_smdk4412-dfd4f0ae2e111e2b93c295938c0e64ebbb69ae6e.tar.bz2 |
[TCP]: Avoid two divides in __tcp_grow_window()
tcp_win_from_space() being signed, compiler might emit an integer divide
to compute tcp_win_from_space()/2 .
Using right shifts is OK here and less expensive.
Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_input.c')
-rw-r--r-- | net/ipv4/tcp_input.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index bc2d5f7..519bd24 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -289,8 +289,8 @@ static int __tcp_grow_window(const struct sock *sk, const struct sk_buff *skb) { struct tcp_sock *tp = tcp_sk(sk); /* Optimize this! */ - int truesize = tcp_win_from_space(skb->truesize)/2; - int window = tcp_win_from_space(sysctl_tcp_rmem[2])/2; + int truesize = tcp_win_from_space(skb->truesize) >> 1; + int window = tcp_win_from_space(sysctl_tcp_rmem[2]) >> 1; while (tp->rcv_ssthresh <= window) { if (truesize <= skb->len) |