Skip to content

Commit 6c97da1

Browse files
lesliemonisdavem330
authored andcommitted
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 <[email protected]> Signed-off-by: Leslie Monis <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 4a8acef commit 6c97da1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

net/sched/sch_pie.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,8 @@ static void calculate_probability(struct Qdisc *sch)
429429
*/
430430

431431
if (qdelay == 0 && qdelay_old == 0 && update_prob)
432-
q->vars.prob = 98 * div_u64(q->vars.prob, 100);
432+
/* Reduce drop probability to 98.4% */
433+
q->vars.prob -= q->vars.prob / 64u;
433434

434435
q->vars.qdelay = qdelay;
435436
q->vars.qlen_old = qlen;

0 commit comments

Comments
 (0)