Skip to contentSkip to conversation

net: pkt_sched: PIE AQM scheme

PATCH RESEND Superseded [email protected] 2 participants 2 messages Dec 20, 2013 – Dec 31, 2013

Subsystems (3)

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH RESEND v4 1/1 net: pkt_sched: PIE AQM scheme

From: Vijay Subramanian <[email protected]>

From: Vijay Subramanian <[email protected]>

Proportional Integral controller Enhanced (PIE) is a scheduler to address the bufferbloat problem.

Quoted 1 line

From the IETF draft below:

" Bufferbloat is a phenomenon where excess buffers in the network cause high latency and jitter. As more and more interactive applications (e.g. voice over IP, real time video streaming and financial transactions) run in the Internet, high latency and jitter degrade application performance. There is a pressing need to design intelligent queue management schemes that can control latency and jitter; and hence provide desirable quality of service to users.

We present here a lightweight design, PIE(Proportional Integral controller Enhanced) that can effectively control the average queueing latency to a target value. Simulation results, theoretical analysis and Linux testbed results have shown that PIE can ensure low latency and achieve high link utilization under various congestion situations. The design does not require per-packet timestamp, so it incurs very small overhead and is simple enough to implement in both hardware and software. "

Many thanks to Dave Taht for extensive feedback, reviews, testing and suggestions. Thanks also to Stephen Hemminger and Eric Dumazet for reviews and suggestions. Naeem Khademi and Dave Taht independently contributed to ECN support.

For more information, please see technical paper about PIE in the IEEE Conference on High Performance Switching and Routing 2013. A copy of the paper can be found at ftp://ftpeng.cisco.com/pie/.

Please also refer to the IETF draft submission at
http://tools.ietf.org/html/draft-pan-tsvwg-pie-00

All relevant code, documents and test scripts and results can be found at ftp://ftpeng.cisco.com/pie/.

For problems with the iproute2/tc or Linux kernel code, please contact Vijay Subramanian ([email protected] or [email protected]) Mythili Prabhu ([email protected])

---
Resending V4 after fixing IPR issues.

Changes from V3: Change default value of limit to 1000 packets and increase QUEUE_THRESHOLD to 10000 bytes. Refactor pie_qdisc_enqueue() to update stats correctly.

Changes from V2: Prevent timer deadlock on qdisc destroy. Also maintain timer period 'tupdate' in us throughout instead of in psched units.

Changes from V1: Addressed review comments regarding coding style and various implementation issues. In particular 1) add locking for the timer and 2) use psched timer directly instead of a custom timer based on psched.

 include/uapi/linux/pkt_sched.h |   25 ++
 net/sched/Kconfig              |   13 +
 net/sched/Makefile             |    1 +
 net/sched/sch_pie.c            |  560 ++++++++++++++++++++++++++++++++++++++++
 4 files changed, 599 insertions(+)
 create mode 100644 net/sched/sch_pie.c
include/uapi/linux/pkt_sched.h +25 -0
index 4566993..621bcf8 100644
@@ -815,4 +815,29 @@ struct tc_hhf_xstats {
 	__u32	hh_tot_count;   /* number of captured heavy-hitters so far */
 	__u32	hh_cur_count;   /* number of current heavy-hitters */
 };
+
+/*PIE*/
+enum {
+	TCA_PIE_UNSPEC,
+	TCA_PIE_TARGET,
+	TCA_PIE_LIMIT,
+	TCA_PIE_TUPDATE,
+	TCA_PIE_ALPHA,
+	TCA_PIE_BETA,
+	TCA_PIE_ECN,
+	TCA_PIE_BYTEMODE,
+	__TCA_PIE_MAX
+};
+#define TCA_PIE_MAX   (__TCA_PIE_MAX - 1)
+
+struct tc_pie_xstats {
+	__u32 prob;             /* current probability */
+	__u32 delay;            /* current delay in ms */
+	__u32 avg_dq_rate;      /* current average dq_rate in bits/pie_time */
+	__u32 packets_in;       /* total number of packets enqueued */
+	__u32 dropped;          /* packets dropped due to pie_action */
+	__u32 overlimit;        /* dropped due to lack of space in queue */
+	__u32 maxq;             /* maximum queue size */
+	__u32 ecn_mark;         /* packets marked with ecn*/
+};
 #endif
net/sched/Kconfig +13 -0
index 919847b..65cacec 100644
@@ -295,6 +295,19 @@ config NET_SCH_HHF
 	  To compile this driver as a module, choose M here: the module
 	  will be called sch_hhf.
 
+config NET_SCH_PIE
+	tristate "Proportional Integral controller Enhanced (PIE) scheduler"
+	help
+	  Say Y here if you want to use the Proportional Integral controller
+	  Enhanced scheduler packet scheduling algorithm.
+	  For more information, please see
+	  http://tools.ietf.org/html/draft-pan-tsvwg-pie-00
+
+	  To compile this driver as a module, choose M here: the module
+	  will be called sch_pie.
+
+	  If unsure, say N.
+
 config NET_SCH_INGRESS
 	tristate "Ingress Qdisc"
 	depends on NET_CLS_ACT
net/sched/Makefile +1 -0
index 3442e5f..0a869a1 100644
@@ -41,6 +41,7 @@ obj-$(CONFIG_NET_SCH_CODEL)	+= sch_codel.o
 obj-$(CONFIG_NET_SCH_FQ_CODEL)	+= sch_fq_codel.o
 obj-$(CONFIG_NET_SCH_FQ)	+= sch_fq.o
 obj-$(CONFIG_NET_SCH_HHF)	+= sch_hhf.o
+obj-$(CONFIG_NET_SCH_PIE)	+= sch_pie.o
 
 obj-$(CONFIG_NET_CLS_U32)	+= cls_u32.o
 obj-$(CONFIG_NET_CLS_ROUTE4)	+= cls_route.o
net/sched/sch_pie.c new file +560 -0

560 lines not on this page · raw message

Signature · 1 line
1.7.9.5
maintainer
#1 lore raw

From: [email protected]
Date: Fri, 20 Dec 2013 14:10:12 -0800

include/uapi/linux/pkt_sched.h struct tc_hhf_xstats { · line 819

Quoted 8 lines
include/uapi/linux/pkt_sched.h +2 -0
@@ -815,4 +815,29 @@ struct tc_hhf_xstats {
 	__u32	hh_tot_count;   /* number of captured heavy-hitters so far */
 	__u32	hh_cur_count;   /* number of current heavy-hitters */
 };
+
+/*PIE*/

Please, a space before and after PIE.

Quoted 5 lines
net/sched/sch_pie.c new file +0 -0
new file mode 100644
index 0000000..1658b65

...

Quoted 1 line

+/* statistics gathering*/

Space after "gathering"

net/sched/sch_pie.c line 89

Quoted 1 line
net/sched/sch_pie.c new file +1 -0
+	/* default of 100 ms in pschedtime  */

Please delete the extra space at the end of that comment.

Quoted 4 lines
net/sched/sch_pie.c new file +4 -0
+	/* tupdate is in us */
+	if (tb[TCA_PIE_TUPDATE])
+		q->params.tupdate = nla_get_u32(tb[TCA_PIE_TUPDATE]);
+

...

net/sched/sch_pie.c line 428

Quoted 5 lines
net/sched/sch_pie.c new file +5 -0
+	/* reset the timer to fire after 'tupdate'. Convert from us to jiffies.
+	 */
+	if (q->params.tupdate)
+		mod_timer(&q->adapt_timer, jiffies +
+			  usecs_to_jiffies(q->params.tupdate));

Timers run more often than configuration changes, please precompute the jiffies from the user given usecs so you don't have to continually recompute it over and over every time the timer gets rescheduled.

net/sched/sch_pie.c line 198

Quoted 6 lines
net/sched/sch_pie.c new file +6 -0
+	/* convert from microseconds to pschedtime */
+	if (tb[TCA_PIE_TARGET]) {
+		/* target is in us */
+		u32 target = nla_get_u32(tb[TCA_PIE_TARGET]);
+		/* convert to pschedtime */
+		q->params.target = PSCHED_NS2TICKS((u64)target * NSEC_PER_USEC);

Please put an empty line after variable declarations.

net/sched/sch_pie.c line 208

Quoted 4 lines
net/sched/sch_pie.c new file +4 -0
+	if (tb[TCA_PIE_LIMIT]) {
+		u32 limit = nla_get_u32(tb[TCA_PIE_LIMIT]);
+		q->params.limit = limit;
+		sch->limit = limit;

Likewise.

Quoted 4 lines
net/sched/sch_pie.c new file +4 -0
+	/* If current queue is about 10 packets or more and dq_count is unset
+	 *  we have enough packets to calculate the drain rate. Save
+	 *  current time as dq_tstamp and start measurement cycle.
+	 */

...

Quoted 9 lines
net/sched/sch_pie.c new file +9 -0
+	/*  Calculate the average drain rate from this value.  If queue length
+	 *  has receded to a small value viz., <= QUEUE_THRESHOLD bytes,reset
+	 *  the dq_count to -1 as we don't have enough packets to calculate the
+	 *  drain rate anymore The following if block is entered only when we
+	 *  have a substantial queue built up (QUEUE_THRESHOLD bytes or more)
+	 *  and we calculate the drain rate for the threshold here.  dq_count is
+	 *  in bytes, time difference in psched_time, hence rate is in
+	 *  bytes/psched_time.
+	 */

...

Quoted 3 lines
net/sched/sch_pie.c new file +3 -0
+	/* addition to ensure we increase probability in steps of no
+	 *  more than 2%
+	 */

...

net/sched/sch_pie.c line 368

Quoted 5 lines
net/sched/sch_pie.c new file +5 -0
+	/*  Non-linear drop
+	 *  Tune drop probability to increase quickly for high delays
+	 *  (250ms and above)
+	 *  250ms is derived through experiments and provides error protection
+	 */

Please format your comments consistently, one space after the "*" on each line.

net/sched/sch_pie.c line 263

Quoted 3 lines
net/sched/sch_pie.c new file +3 -0
+	if (q->vars.dq_count != DQCOUNT_INVALID) {
+
+		q->vars.dq_count += skb->len;

Please delete that extraneous empty line.

net/sched/sch_pie.c line 369

Quoted 5 lines
net/sched/sch_pie.c new file +5 -0
+	if (delta > (s32) (MAX_PROB / (100 / 2))
+	    && q->vars.prob >= MAX_PROB / 10)
+		delta = (MAX_PROB / 100) * 2;
+
+

Likewise.

net/sched/sch_pie.c line 395

Quoted 4 lines
net/sched/sch_pie.c new file +4 -0
+	/* Non-linear drop in probability */
+	/* Reduce drop probability quickly if delay is 0 for 2 consecutive
+	 * Tupdate periods
+	 */

Just make this all one comment.

net/sched/sch_pie.c line 412

Quoted 5 lines
net/sched/sch_pie.c new file +5 -0
+	if ((q->vars.qdelay < q->params.target / 2)
+	    && (q->vars.qdelay_old < q->params.target / 2)
+	    && (q->vars.prob == 0)
+	    && q->vars.avg_dq_rate > 0)
+		pie_vars_init(&q->vars);

Please format this as:

	if (A &&
	    B &&

Do not place the "&&" or similar operator at the beginning of the line.