Skip to content

Commit

Permalink
[NET]: Avoid divides in net/core/gen_estimator.c
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Jan 28, 2008
1 parent e870a8e commit 789675e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/core/gen_estimator.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ static void est_timer(unsigned long arg)
}

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();
}

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 789675e

Please sign in to comment.