Skip to contentSkip to conversation

: Avoid divides in net/core/gen_estimator.c

NET Applied Eric Dumazet 2 participants 2 messages Jan 3, 2008 – Jan 4, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

We can void divides (as seen with CONFIG_CC_OPTIMIZE_FOR_SIZE=y on x86) changing ((HZ<<idx)/4) to ((HZ/4) << idx)

net/core/gen_estimator.c +2 -2
index daadbcc..86037d1 100644
@@ -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;