Skip to contentSkip to conversation

net: pkt_sched: PIE AQM scheme

PATCH Superseded Vijay Subramanian 2 participants 3 messages Oct 30, 2013 – Oct 31, 2013

Subsystems (3)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 net: pkt_sched: PIE AQM scheme

From: Vijay Subramanian <[email protected]>

Proportional Integral controller Enhanced (PIE) scheduler for bufferbloat.

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 for initial review and suggestion
to use psched and friends. 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, 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])

---
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 |   26 ++
 net/sched/Kconfig              |   13 +
 net/sched/Makefile             |    1 +
 net/sched/sch_pie.c            |  567 ++++++++++++++++++++++++++++++++++++++++
 4 files changed, 607 insertions(+)
 create mode 100644 net/sched/sch_pie.c
include/uapi/linux/pkt_sched.h +26 -0
index f2624b5..2fb6e6d 100644
@@ -787,4 +787,30 @@ struct tc_fq_qd_stats {
 	__u32	throttled_flows;
 	__u32	pad;
 };
+
+/*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 c03a32a..a079e03 100644
@@ -286,6 +286,19 @@ config NET_SCH_FQ
 
 	  If unsure, say N.
 
+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 e5f9abe..5b4ece9 100644
@@ -40,6 +40,7 @@ obj-$(CONFIG_NET_SCH_QFQ)	+= sch_qfq.o
 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_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 +567 -0

567 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#1 lore raw

net/sched/sch_pie.c line 534

Quoted 5 lines · Vijay Subramanian
net/sched/sch_pie.c new file +5 -0
+static void pie_destroy(struct Qdisc *sch)
+{
+	struct pie_sched_data *q = qdisc_priv(sch);
+	del_timer_sync(&q->adapt_timer);
+}

This doesn't look safe to me.

timer can rearm itself.

Take a look at commit 980c478ddbb720948967b028ddbb4179a025bc2c

#2 lore raw
In reply to Vijay Subramanian

On Wed, 2013-10-30 at 14:18 -0700, Vijay Subramanian wrote:

+ if (tb[TCA_PIE_TUPDATE]) {

+               /* tupdate is in us */
+               u32 tupdate = nla_get_u32(tb[TCA_PIE_TUPDATE]);
+               /* convert to pschedtime */
+               q->params.tupdate = PSCHED_NS2TICKS((u64) tupdate * NSEC_PER_USEC);

+ }

...

Quoted 12 lines
net/sched/sch_pie.c new file +12 -0
+static void pie_timer(unsigned long arg)
+{
+	struct Qdisc *sch = (struct Qdisc *)arg;
+	struct pie_sched_data *q = qdisc_priv(sch);
+	u32 tup;
+	spinlock_t *root_lock = qdisc_lock(qdisc_root_sleeping(sch));
+
+	spin_lock(root_lock);
+	calculate_probability(sch);
+
+	/* reset the timer to fire after 'tupdate'. tupdate is currently in
+	 * psched_time; mod_timer expects time to be in jiffies so convert from

net/sched/sch_pie.c line 437

Quoted 10 lines
net/sched/sch_pie.c new file +10 -0
+	 * pschedtime to jiffies
+	 */
+	tup = PSCHED_TICKS2NS(q->params.tupdate);
+	tup = tup / NSEC_PER_MSEC;
+	tup = (tup * HZ) / MSEC_PER_SEC;
+
+	mod_timer(&q->adapt_timer, jiffies + tup);
+	spin_unlock(root_lock);
+
+}

Oh well, this makes no sense.

mod_timer() resolution is in jiffies, so please maintains params.tupdate in usec, and use usecs_to_jiffies()

	mod_timer(&q->adapt_timer, jiffies +
				   usecs_to_jiffies(q->params.tupdate));