All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leslie Monis <lesliemonis@gmail.com>
To: jhs@mojatatu.com
Cc: netdev@vger.kernel.org, tahiliani@nitk.edu.in,
	dhavaljkhandla26@gmail.com, hrishihiraskar@gmail.com,
	bmanish15597@gmail.com, sdp.sachin@gmail.com
Subject: [PATCH net-next 6/8] net: sched: pie: add mechanism to set PIE active/inactive
Date: Wed, 31 Oct 2018 21:49:30 +0530	[thread overview]
Message-ID: <1541002772-28040-7-git-send-email-lesliemonis@gmail.com> (raw)
In-Reply-To: <1541002772-28040-1-git-send-email-lesliemonis@gmail.com>

From: "Mohit P. Tahiliani" <tahiliani@nitk.edu.in>

To overcome unnecessary packet drops due to a spurious
uptick in queuing latency caused by fluctuations in a
network, PIE can choose to be active only when the queue
occupancy is over a certain threshold. RFC 8033 suggests
the value of this threshold be 1/3 of the tail drop
threshold. PIE becomes inactive when the congestion ends
i.e., when the drop probability reaches 0, and the current
and previous latency samples are all below half of the
target queue delay.

Signed-off-by: Mohit P. Tahiliani <tahiliani@nitk.edu.in>
Signed-off-by: Dhaval Khandla <dhavaljkhandla26@gmail.com>
Signed-off-by: Hrishikesh Hiraskar <hrishihiraskar@gmail.com>
Signed-off-by: Manish Kumar B <bmanish15597@gmail.com>
Signed-off-by: Sachin D. Patil <sdp.sachin@gmail.com>
Signed-off-by: Leslie Monis <lesliemonis@gmail.com>
---
 net/sched/sch_pie.c | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/net/sched/sch_pie.c b/net/sched/sch_pie.c
index c84e91e..b68b367 100644
--- a/net/sched/sch_pie.c
+++ b/net/sched/sch_pie.c
@@ -57,6 +57,7 @@ struct pie_vars {
 	psched_time_t dq_tstamp;	/* drain rate */
 	u32 avg_dq_rate;	/* bytes per pschedtime tick,scaled */
 	u32 qlen_old;		/* in bytes */
+	bool active;		/* inactive/active */
 };
 
 /* statistics gathering */
@@ -94,6 +95,7 @@ static void pie_vars_init(struct pie_vars *vars)
 	vars->avg_dq_rate = 0;
 	/* default of 150 ms in pschedtime */
 	vars->burst_time = PSCHED_NS2TICKS(150 * NSEC_PER_MSEC);
+	vars->active = true;
 }
 
 static bool drop_early(struct Qdisc *sch, u32 packet_size)
@@ -141,12 +143,23 @@ static int pie_qdisc_enqueue(struct sk_buff *skb, struct Qdisc *sch,
 	struct pie_sched_data *q = qdisc_priv(sch);
 	bool enqueue = false;
 
+	if (!q->vars.active && qdisc_qlen(sch) >= sch->limit / 3) {
+		/* If the queue occupancy is over 1/3 of the tail drop
+		 * threshold, turn on PIE.
+		 */
+		pie_vars_init(&q->vars);
+		q->vars.prob = 0;
+		q->vars.qdelay_old = 0;
+		q->vars.dq_count = 0;
+		q->vars.dq_tstamp = psched_get_time();
+	}
+
 	if (unlikely(qdisc_qlen(sch) >= sch->limit)) {
 		q->stats.overlimit++;
 		goto out;
 	}
 
-	if (!drop_early(sch, skb->len)) {
+	if (!q->vars.active || !drop_early(sch, skb->len)) {
 		enqueue = true;
 	} else if (q->params.ecn && (q->vars.prob <= MAX_PROB / 10) &&
 		   INET_ECN_set_ce(skb)) {
@@ -431,7 +444,7 @@ static void calculate_probability(struct Qdisc *sch)
 	q->vars.qdelay = qdelay;
 	q->vars.qlen_old = qlen;
 
-	/* We restart the measurement cycle if the following conditions are met
+	/* We turn off PIE if the following conditions are met
 	 * 1. If the delay has been low for 2 consecutive Tupdate periods
 	 * 2. Calculated drop probability is zero
 	 * 3. We have atleast one estimate for the avg_dq_rate ie.,
@@ -441,7 +454,7 @@ static void calculate_probability(struct Qdisc *sch)
 	    (q->vars.qdelay_old < q->params.target / 2) &&
 	    q->vars.prob == 0 &&
 	    q->vars.avg_dq_rate > 0)
-		pie_vars_init(&q->vars);
+		q->vars.active = false;
 }
 
 static void pie_timer(struct timer_list *t)
@@ -451,7 +464,8 @@ static void pie_timer(struct timer_list *t)
 	spinlock_t *root_lock = qdisc_lock(qdisc_root_sleeping(sch));
 
 	spin_lock(root_lock);
-	calculate_probability(sch);
+	if (q->vars.active)
+		calculate_probability(sch);
 
 	/* reset the timer to fire after 'tupdate'. tupdate is in jiffies. */
 	if (q->params.tupdate)
-- 
2.7.4

  parent reply	other threads:[~2018-11-01  1:18 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-31 16:19 [PATCH net-next 0/8] net: sched: pie: align PIE implementation with RFC 8033 Leslie Monis
2018-10-31 16:19 ` [PATCH net-next 1/8] net: sched: pie: change value of QUEUE_THRESHOLD Leslie Monis
2018-10-31 16:19 ` [PATCH net-next 2/8] net: sched: pie: change default value of pie_params->target Leslie Monis
2018-10-31 16:19 ` [PATCH net-next 3/8] net: sched: pie: change default value of pie_params->tupdate Leslie Monis
2018-10-31 16:19 ` [PATCH net-next 4/8] net: sched: pie: change initial value of pie_vars->burst_time Leslie Monis
2018-10-31 16:19 ` [PATCH net-next 5/8] net: sched: pie: add more conditions to auto-tune alpha and beta Leslie Monis
2018-10-31 16:40   ` Stephen Hemminger
2018-10-31 16:19 ` Leslie Monis [this message]
2018-10-31 16:41   ` [PATCH net-next 6/8] net: sched: pie: add mechanism to set PIE active/inactive Stephen Hemminger
2018-10-31 16:19 ` [PATCH net-next 7/8] net: sched: pie: add derandomization mechanism Leslie Monis
2018-10-31 16:38   ` Stephen Hemminger
2018-10-31 16:19 ` [PATCH net-next 8/8] net: sched: pie: update references Leslie Monis
2018-10-31 16:36 ` [PATCH net-next 0/8] net: sched: pie: align PIE implementation with RFC 8033 Stephen Hemminger
2018-10-31 17:43 ` 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=1541002772-28040-7-git-send-email-lesliemonis@gmail.com \
    --to=lesliemonis@gmail.com \
    --cc=bmanish15597@gmail.com \
    --cc=dhavaljkhandla26@gmail.com \
    --cc=hrishihiraskar@gmail.com \
    --cc=jhs@mojatatu.com \
    --cc=netdev@vger.kernel.org \
    --cc=sdp.sachin@gmail.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.