Skip to contentSkip to conversation

Two small fq_codel optimizations

PATCH In review Dave Taht 2 participants 4 messages Aug 3, 2019 – Aug 6, 2019

Subsystems (3)
lore
Share & tools
lore

Dave Taht

author
#0 lore raw

cover Two small fq_codel optimizations

These two patches improve fq_codel performance under extreme network loads. The first patch more rapidly escalates the codel count under overload, the second just kills a totally useless statistic.

(sent together because they'd otherwise conflict)

Dave Taht (2):
Increase fq_codel count in the bulk dropper
fq_codel: Kill useless per-flow dropped statistic

 net/sched/sch_fq_codel.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH 1/2 Increase fq_codel count in the bulk dropper

In the field fq_codel is often used with a smaller memory or packet limit than the default, and when the bulk dropper is hit, the drop pattern bifircates into one that more slowly increases the codel drop rate and hits the bulk dropper more than it should.

The scan through the 1024 queues happens more often than it needs to.

This patch increases the codel count in the bulk dropper, but does not change the drop rate there, relying on the next codel round to deliver the next packet at the original drop rate (after that burst of loss), then escalate to a higher signaling rate.

---
 net/sched/sch_fq_codel.c | 2 ++
 1 file changed, 2 insertions(+)
net/sched/sch_fq_codel.c +2 -0
index d59fbcc745d1..d67b2c40e6e6 100644
@@ -173,6 +173,8 @@ static unsigned int fq_codel_drop(struct Qdisc *sch, unsigned int max_packets,
 		__qdisc_drop(skb, to_free);
 	} while (++i < max_packets && len < threshold);
 
+	/* Tell codel to increase its signal strength also */
+	flow->cvars.count += i;
 	flow->dropped += i;
 	q->backlogs[idx] -= len;
 	q->memory_usage -= mem;
Signature · 1 line
2.17.1
author
#2 lore raw

PATCH 2/2 fq_codel: Kill useless per-flow dropped statistic

In reply to Dave Taht

It is almost impossible to get anything other than a 0 out of flow->dropped statistic with a tc class dump, as it resets to 0 on every round.

It also conflates ecn marks with drops.

It would have been useful had it kept a cumulative drop count, but it doesn't. This patch doesn't change the API, it just stops tracking a stat and state that is impossible to measure and nobody uses.

---
 net/sched/sch_fq_codel.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
net/sched/sch_fq_codel.c +1 -7
index d67b2c40e6e6..9edd0f495001 100644
@@ -45,7 +45,6 @@ struct fq_codel_flow {
 	struct sk_buff	  *tail;
 	struct list_head  flowchain;
 	int		  deficit;
-	u32		  dropped; /* number of drops (or ECN marks) on this flow */
 	struct codel_vars cvars;
 }; /* please try to keep this structure <= 64 bytes */
 
@@ -175,7 +174,6 @@ static unsigned int fq_codel_drop(struct Qdisc *sch, unsigned int max_packets,
 
 	/* Tell codel to increase its signal strength also */
 	flow->cvars.count += i;
-	flow->dropped += i;
 	q->backlogs[idx] -= len;
 	q->memory_usage -= mem;
 	sch->qstats.drops += i;
@@ -213,7 +211,6 @@ static int fq_codel_enqueue(struct sk_buff *skb, struct Qdisc *sch,
 		list_add_tail(&flow->flowchain, &q->new_flows);
 		q->new_flow_count++;
 		flow->deficit = q->quantum;
-		flow->dropped = 0;
 	}
 	get_codel_cb(skb)->mem_usage = skb->truesize;
 	q->memory_usage += get_codel_cb(skb)->mem_usage;
@@ -312,9 +309,6 @@ static struct sk_buff *fq_codel_dequeue(struct Qdisc *sch)
 			    &flow->cvars, &q->cstats, qdisc_pkt_len,
 			    codel_get_enqueue_time, drop_func, dequeue_func);
 
-	flow->dropped += q->cstats.drop_count - prev_drop_count;
-	flow->dropped += q->cstats.ecn_mark - prev_ecn_mark;
-
 	if (!skb) {
 		/* force a pass through old_flows to prevent starvation */
 		if ((head == &q->new_flows) && !list_empty(&q->old_flows))
@@ -660,7 +654,7 @@ static int fq_codel_dump_class_stats(struct Qdisc *sch, unsigned long cl,
 			sch_tree_unlock(sch);
 		}
 		qs.backlog = q->backlogs[idx];
-		qs.drops = flow->dropped;
+		qs.drops = 0;
 	}
 	if (gnet_stats_copy_queue(d, NULL, &qs, qs.qlen) < 0)
 		return -1;
Signature · 1 line
2.17.1
maintainer
#3 lore raw
In reply to Dave Taht

From: Dave Taht <[email protected]>
Date: Sat, 3 Aug 2019 16:37:27 -0700

Quoted 9 lines

These two patches improve fq_codel performance under extreme network loads. The first patch more rapidly escalates the codel count under overload, the second just kills a totally useless statistic.

(sent together because they'd otherwise conflict)

Series applied.