]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
net: sched: pie: avoid slow division in drop probability decay
authorLeslie Monis <lesliemonis@gmail.com>
Thu, 28 Feb 2019 12:36:54 +0000 (18:06 +0530)
committerDavid S. Miller <davem@davemloft.net>
Thu, 28 Feb 2019 18:35:41 +0000 (10:35 -0800)
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 <David.Laight@aculab.com>
Signed-off-by: Leslie Monis <lesliemonis@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/sch_pie.c

index f93cfe034c72984a0d137cd796f00fbd43eda395..1cc0c7b74aa3531fa649df1142f7dbff3034ab23 100644 (file)
@@ -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;