Skip to content

Commit 4b549a2

Browse files
Eric Dumazetdavem330
Eric Dumazet
authored andcommitted
fq_codel: Fair Queue Codel AQM
Fair Queue Codel packet scheduler Principles : - Packets are classified (internal classifier or external) on flows. - This is a Stochastic model (as we use a hash, several flows might be hashed on same slot) - Each flow has a CoDel managed queue. - Flows are linked onto two (Round Robin) lists, so that new flows have priority on old ones. - For a given flow, packets are not reordered (CoDel uses a FIFO) - head drops only. - ECN capability is on by default. - Very low memory footprint (64 bytes per flow) tc qdisc ... fq_codel [ limit PACKETS ] [ flows number ] [ target TIME ] [ interval TIME ] [ noecn ] [ quantum BYTES ] defaults : 1024 flows, 10240 packets limit, quantum : device MTU target : 5ms (CoDel default) interval : 100ms (CoDel default) Impressive results on load : class htb 1:1 root leaf 10: prio 0 quantum 1514 rate 200000Kbit ceil 200000Kbit burst 1475b/8 mpu 0b overhead 0b cburst 1475b/8 mpu 0b overhead 0b level 0 Sent 43304920109 bytes 33063109 pkt (dropped 0, overlimits 0 requeues 0) rate 201691Kbit 28595pps backlog 0b 312p requeues 0 lended: 33063109 borrowed: 0 giants: 0 tokens: -912 ctokens: -912 class fq_codel 10:1735 parent 10: (dropped 1292, overlimits 0 requeues 0) backlog 15140b 10p requeues 0 deficit 1514 count 1 lastcount 1 ldelay 7.1ms class fq_codel 10:4524 parent 10: (dropped 1291, overlimits 0 requeues 0) backlog 16654b 11p requeues 0 deficit 1514 count 1 lastcount 1 ldelay 7.1ms class fq_codel 10:4e74 parent 10: (dropped 1290, overlimits 0 requeues 0) backlog 6056b 4p requeues 0 deficit 1514 count 1 lastcount 1 ldelay 6.4ms dropping drop_next 92.0ms class fq_codel 10:628a parent 10: (dropped 1289, overlimits 0 requeues 0) backlog 7570b 5p requeues 0 deficit 1514 count 1 lastcount 1 ldelay 5.4ms dropping drop_next 90.9ms class fq_codel 10:a4b3 parent 10: (dropped 302, overlimits 0 requeues 0) backlog 16654b 11p requeues 0 deficit 1514 count 1 lastcount 1 ldelay 7.1ms class fq_codel 10:c3c2 parent 10: (dropped 1284, overlimits 0 requeues 0) backlog 13626b 9p requeues 0 deficit 1514 count 1 lastcount 1 ldelay 5.9ms class fq_codel 10:d331 parent 10: (dropped 299, overlimits 0 requeues 0) backlog 15140b 10p requeues 0 deficit 1514 count 1 lastcount 1 ldelay 7.0ms class fq_codel 10:d526 parent 10: (dropped 12160, overlimits 0 requeues 0) backlog 35870b 211p requeues 0 deficit 1508 count 12160 lastcount 1 ldelay 15.3ms dropping drop_next 247us class fq_codel 10:e2c6 parent 10: (dropped 1288, overlimits 0 requeues 0) backlog 15140b 10p requeues 0 deficit 1514 count 1 lastcount 1 ldelay 7.1ms class fq_codel 10:eab5 parent 10: (dropped 1285, overlimits 0 requeues 0) backlog 16654b 11p requeues 0 deficit 1514 count 1 lastcount 1 ldelay 5.9ms class fq_codel 10:f220 parent 10: (dropped 1289, overlimits 0 requeues 0) backlog 15140b 10p requeues 0 deficit 1514 count 1 lastcount 1 ldelay 7.1ms qdisc htb 1: root refcnt 6 r2q 10 default 1 direct_packets_stat 0 ver 3.17 Sent 43331086547 bytes 33092812 pkt (dropped 0, overlimits 66063544 requeues 71) rate 201697Kbit 28602pps backlog 0b 260p requeues 71 qdisc fq_codel 10: parent 1:1 limit 10240p flows 65536 target 5.0ms interval 100.0ms ecn Sent 43331086547 bytes 33092812 pkt (dropped 949359, overlimits 0 requeues 0) rate 201697Kbit 28602pps backlog 189352b 260p requeues 0 maxpacket 1514 drop_overlimit 0 new_flow_count 5582 ecn_mark 125593 new_flows_len 0 old_flows_len 11 PING 172.30.42.18 (172.30.42.18) 56(84) bytes of data. 64 bytes from 172.30.42.18: icmp_req=1 ttl=64 time=0.227 ms 64 bytes from 172.30.42.18: icmp_req=2 ttl=64 time=0.165 ms 64 bytes from 172.30.42.18: icmp_req=3 ttl=64 time=0.166 ms 64 bytes from 172.30.42.18: icmp_req=4 ttl=64 time=0.151 ms 64 bytes from 172.30.42.18: icmp_req=5 ttl=64 time=0.164 ms 64 bytes from 172.30.42.18: icmp_req=6 ttl=64 time=0.172 ms 64 bytes from 172.30.42.18: icmp_req=7 ttl=64 time=0.175 ms 64 bytes from 172.30.42.18: icmp_req=8 ttl=64 time=0.183 ms 64 bytes from 172.30.42.18: icmp_req=9 ttl=64 time=0.158 ms 64 bytes from 172.30.42.18: icmp_req=10 ttl=64 time=0.200 ms 10 packets transmitted, 10 received, 0% packet loss, time 8999ms rtt min/avg/max/mdev = 0.151/0.176/0.227/0.022 ms Much better than SFQ because of priority given to new flows, and fast path dirtying less cache lines. Signed-off-by: Eric Dumazet <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 536edd6 commit 4b549a2

File tree

4 files changed

+690
-0
lines changed

4 files changed

+690
-0
lines changed

include/linux/pkt_sched.h

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -681,4 +681,58 @@ struct tc_codel_xstats {
681681
__u32 dropping; /* are we in dropping state ? */
682682
};
683683

684+
/* FQ_CODEL */
685+
686+
enum {
687+
TCA_FQ_CODEL_UNSPEC,
688+
TCA_FQ_CODEL_TARGET,
689+
TCA_FQ_CODEL_LIMIT,
690+
TCA_FQ_CODEL_INTERVAL,
691+
TCA_FQ_CODEL_ECN,
692+
TCA_FQ_CODEL_FLOWS,
693+
TCA_FQ_CODEL_QUANTUM,
694+
__TCA_FQ_CODEL_MAX
695+
};
696+
697+
#define TCA_FQ_CODEL_MAX (__TCA_FQ_CODEL_MAX - 1)
698+
699+
enum {
700+
TCA_FQ_CODEL_XSTATS_QDISC,
701+
TCA_FQ_CODEL_XSTATS_CLASS,
702+
};
703+
704+
struct tc_fq_codel_qd_stats {
705+
__u32 maxpacket; /* largest packet we've seen so far */
706+
__u32 drop_overlimit; /* number of time max qdisc
707+
* packet limit was hit
708+
*/
709+
__u32 ecn_mark; /* number of packets we ECN marked
710+
* instead of being dropped
711+
*/
712+
__u32 new_flow_count; /* number of time packets
713+
* created a 'new flow'
714+
*/
715+
__u32 new_flows_len; /* count of flows in new list */
716+
__u32 old_flows_len; /* count of flows in old list */
717+
};
718+
719+
struct tc_fq_codel_cl_stats {
720+
__s32 deficit;
721+
__u32 ldelay; /* in-queue delay seen by most recently
722+
* dequeued packet
723+
*/
724+
__u32 count;
725+
__u32 lastcount;
726+
__u32 dropping;
727+
__s32 drop_next;
728+
};
729+
730+
struct tc_fq_codel_xstats {
731+
__u32 type;
732+
union {
733+
struct tc_fq_codel_qd_stats qdisc_stats;
734+
struct tc_fq_codel_cl_stats class_stats;
735+
};
736+
};
737+
684738
#endif

net/sched/Kconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,17 @@ config NET_SCH_CODEL
261261

262262
If unsure, say N.
263263

264+
config NET_SCH_FQ_CODEL
265+
tristate "Fair Queue Controlled Delay AQM (FQ_CODEL)"
266+
help
267+
Say Y here if you want to use the FQ Controlled Delay (FQ_CODEL)
268+
packet scheduling algorithm.
269+
270+
To compile this driver as a module, choose M here: the module
271+
will be called sch_fq_codel.
272+
273+
If unsure, say N.
274+
264275
config NET_SCH_INGRESS
265276
tristate "Ingress Qdisc"
266277
depends on NET_CLS_ACT

net/sched/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ obj-$(CONFIG_NET_SCH_MQPRIO) += sch_mqprio.o
3838
obj-$(CONFIG_NET_SCH_CHOKE) += sch_choke.o
3939
obj-$(CONFIG_NET_SCH_QFQ) += sch_qfq.o
4040
obj-$(CONFIG_NET_SCH_CODEL) += sch_codel.o
41+
obj-$(CONFIG_NET_SCH_FQ_CODEL) += sch_fq_codel.o
4142

4243
obj-$(CONFIG_NET_CLS_U32) += cls_u32.o
4344
obj-$(CONFIG_NET_CLS_ROUTE4) += cls_route.o

0 commit comments

Comments
 (0)