generic: early (incomplete!) 4.0 support
[openwrt/openwrt.git] / target / linux / generic / patches-4.0 / 657-qdisc_reduce_truesize.patch
1 From bc9fec2f87d57bdbff30d296605e24504513f65c Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Dave=20T=C3=A4ht?= <dave.taht@bufferbloat.net>
3 Date: Mon, 17 Sep 2012 19:20:22 -0700
4 Subject: [PATCH 4/7] net: add skb_reduce_truesize support to common qdiscs
5
6 Reduce skb size under load when queues begin to fill on the
7 commont qdiscs.
8 ---
9 net/sched/sch_codel.c | 2 ++
10 net/sched/sch_fifo.c | 12 ++++++++----
11 net/sched/sch_fq_codel.c | 2 ++
12 3 files changed, 12 insertions(+), 4 deletions(-)
13
14 --- a/net/sched/sch_codel.c
15 +++ b/net/sched/sch_codel.c
16 @@ -96,6 +96,8 @@ static int codel_qdisc_enqueue(struct sk
17 struct codel_sched_data *q;
18
19 if (likely(qdisc_qlen(sch) < sch->limit)) {
20 + if(qdisc_qlen(sch) > 128)
21 + skb = skb_reduce_truesize(skb);
22 codel_set_enqueue_time(skb);
23 return qdisc_enqueue_tail(skb, sch);
24 }
25 --- a/net/sched/sch_fifo.c
26 +++ b/net/sched/sch_fifo.c
27 @@ -29,17 +29,21 @@ static int bfifo_enqueue(struct sk_buff
28
29 static int pfifo_enqueue(struct sk_buff *skb, struct Qdisc *sch)
30 {
31 - if (likely(skb_queue_len(&sch->q) < sch->limit))
32 + if (likely(skb_queue_len(&sch->q) < sch->limit)) {
33 + if (skb_queue_len(&sch->q) > 128)
34 + skb = skb_reduce_truesize(skb);
35 return qdisc_enqueue_tail(skb, sch);
36 -
37 + }
38 return qdisc_reshape_fail(skb, sch);
39 }
40
41 static int pfifo_tail_enqueue(struct sk_buff *skb, struct Qdisc *sch)
42 {
43 - if (likely(skb_queue_len(&sch->q) < sch->limit))
44 + if (likely(skb_queue_len(&sch->q) < sch->limit)) {
45 + if (skb_queue_len(&sch->q) > 128)
46 + skb = skb_reduce_truesize(skb);
47 return qdisc_enqueue_tail(skb, sch);
48 -
49 + }
50 /* queue full, remove one skb to fulfill the limit */
51 __qdisc_queue_drop_head(sch, &sch->q);
52 qdisc_qstats_drop(sch);
53 --- a/net/sched/sch_fq_codel.c
54 +++ b/net/sched/sch_fq_codel.c
55 @@ -185,6 +185,8 @@ static int fq_codel_enqueue(struct sk_bu
56 return ret;
57 }
58 idx--;
59 + if (sch->q.qlen > 128)
60 + skb = skb_reduce_truesize(skb);
61
62 codel_set_enqueue_time(skb);
63 flow = &q->flows[idx];