netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leslie Monis <lesliemonis@gmail.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, tahiliani@nitk.edu.in,
	dave.taht@gmail.com, Leslie Monis <lesliemonis@gmail.com>
Subject: [PATCH net-next] net: sched: pie: avoid slow division in drop probability decay
Date: Thu, 28 Feb 2019 18:06:54 +0530	[thread overview]
Message-ID: <20190228123654.26330-1-lesliemonis@gmail.com> (raw)

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>
---
 net/sched/sch_pie.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/sched/sch_pie.c b/net/sched/sch_pie.c
index f93cfe034c72..1cc0c7b74aa3 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;
-- 
2.17.1


             reply	other threads:[~2019-02-28 12:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-28 12:36 Leslie Monis [this message]
2019-02-28 18:35 ` [PATCH net-next] net: sched: pie: avoid slow division in drop probability decay David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190228123654.26330-1-lesliemonis@gmail.com \
    --to=lesliemonis@gmail.com \
    --cc=dave.taht@gmail.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=tahiliani@nitk.edu.in \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).