* [NET]: Avoid divides in net/core/gen_estimator.c
@ 2008-01-03 13:12 Eric Dumazet
2008-01-04 4:40 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Eric Dumazet @ 2008-01-03 13:12 UTC (permalink / raw)
To: David Miller; +Cc: netdev@vger.kernel.org
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>
diff --git a/net/core/gen_estimator.c b/net/core/gen_estimator.c
index daadbcc..86037d1 100644
--- a/net/core/gen_estimator.c
+++ b/net/core/gen_estimator.c
@@ -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;
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-01-04 4:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-03 13:12 [NET]: Avoid divides in net/core/gen_estimator.c Eric Dumazet
2008-01-04 4:40 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox