Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b790cedd24a7f7d1639072b3faf35f1f56cb38ea
Commit:     b790cedd24a7f7d1639072b3faf35f1f56cb38ea
Parent:     9cb5734e5b9b26097c7fa28a9c6426a204cc15e3
Author:     Eric Dumazet <[EMAIL PROTECTED]>
AuthorDate: Fri Dec 21 01:49:07 2007 -0800
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Mon Jan 28 14:59:57 2008 -0800

    [INET]: Avoid an integer divide in rt_garbage_collect()
    
    Since 'goal' is a signed int, compiler may emit an integer divide
    to compute goal/2.
    
    Using a right shift is OK here and less expensive.
    
    Signed-off-by: Eric Dumazet <[EMAIL PROTECTED]>
    Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
---
 net/ipv4/route.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 1cc6c23..933b093 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -851,14 +851,14 @@ static int rt_garbage_collect(void)
                        equilibrium = ipv4_dst_ops.gc_thresh;
                goal = atomic_read(&ipv4_dst_ops.entries) - equilibrium;
                if (goal > 0) {
-                       equilibrium += min_t(unsigned int, goal / 2, 
rt_hash_mask + 1);
+                       equilibrium += min_t(unsigned int, goal >> 1, 
rt_hash_mask + 1);
                        goal = atomic_read(&ipv4_dst_ops.entries) - equilibrium;
                }
        } else {
                /* We are in dangerous area. Try to reduce cache really
                 * aggressively.
                 */
-               goal = max_t(unsigned int, goal / 2, rt_hash_mask + 1);
+               goal = max_t(unsigned int, goal >> 1, rt_hash_mask + 1);
                equilibrium = atomic_read(&ipv4_dst_ops.entries) - goal;
        }
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to