From: Leslie Monis Date: Thu, 28 Feb 2019 12:36:54 +0000 (+0530) Subject: net: sched: pie: avoid slow division in drop probability decay X-Git-Tag: v5.1-rc1~178^2~53 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6c97da141528097eb8e1d532dc0dbe3501f4c8ff;p=thirdparty%2Fkernel%2Flinux.git net: sched: pie: avoid slow division in drop probability decay As per RFC 8033, it is sufficient for the drop probability decay factor to have a value of (1 - 1/64) instead of 98%. This avoids the need to do slow division. Suggested-by: David Laight Signed-off-by: Leslie Monis Signed-off-by: David S. Miller --- diff --git a/net/sched/sch_pie.c b/net/sched/sch_pie.c index f93cfe034c729..1cc0c7b74aa35 100644 --- a/net/sched/sch_pie.c +++ b/net/sched/sch_pie.c @@ -429,7 +429,8 @@ static void calculate_probability(struct Qdisc *sch) */ if (qdelay == 0 && qdelay_old == 0 && update_prob) - q->vars.prob = 98 * div_u64(q->vars.prob, 100); + /* Reduce drop probability to 98.4% */ + q->vars.prob -= q->vars.prob / 64u; q->vars.qdelay = qdelay; q->vars.qlen_old = qlen;