]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[NET]: Avoid divides in net/core/gen_estimator.c
authorEric Dumazet <dada1@cosmosbay.com>
Fri, 4 Jan 2008 04:40:01 +0000 (20:40 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Jan 2008 23:00:35 +0000 (15:00 -0800)
We can void divides (as seen with CONFIG_CC_OPTIMIZE_FOR_SIZE=y on x86)
changing ((HZ<<idx)/4) to ((HZ/4) << idx)

Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/gen_estimator.c

index daadbcc4e8dd7e45d92205f6ef4810a315ce3a62..86037d16f199d2e89ff021811bf210a2e5e3503f 100644 (file)
@@ -135,7 +135,7 @@ skip:
        }
 
        if (!list_empty(&elist[idx].list))
-               mod_timer(&elist[idx].timer, jiffies + ((HZ<<idx)/4));
+               mod_timer(&elist[idx].timer, jiffies + ((HZ/4) << idx));
        rcu_read_unlock();
 }
 
@@ -191,7 +191,7 @@ int gen_new_estimator(struct gnet_stats_basic *bstats,
        }
 
        if (list_empty(&elist[idx].list))
-               mod_timer(&elist[idx].timer, jiffies + ((HZ<<idx)/4));
+               mod_timer(&elist[idx].timer, jiffies + ((HZ/4) << idx));
 
        list_add_rcu(&est->list, &elist[idx].list);
        return 0;