1 From: Eric Dumazet <edumazet@google.com>
2 Date: Sun, 15 May 2016 18:16:38 -0700
3 Subject: [PATCH] fq_codel: fix memory limitation drift
5 memory_usage must be decreased in dequeue_func(), not in
6 fq_codel_dequeue(), otherwise packets dropped by Codel algo
7 are missing this decrease.
9 Also we need to clear memory_usage in fq_codel_reset()
11 Fixes: 95b58430abe7 ("fq_codel: add memory limitation per queue")
12 Signed-off-by: Eric Dumazet <edumazet@google.com>
15 --- a/net/sched/sch_fq_codel.c
16 +++ b/net/sched/sch_fq_codel.c
17 @@ -259,6 +259,7 @@ static struct sk_buff *dequeue(struct co
19 skb = dequeue_head(flow);
20 q->backlogs[flow - q->flows] -= qdisc_pkt_len(skb);
21 + q->memory_usage -= skb->truesize;
25 @@ -306,7 +307,6 @@ begin:
26 list_del_init(&flow->flowchain);
29 - q->memory_usage -= skb->truesize;
30 qdisc_bstats_update(sch, skb);
31 flow->deficit -= qdisc_pkt_len(skb);
32 /* We cant call qdisc_tree_reduce_backlog() if our qlen is 0,
33 @@ -343,6 +343,7 @@ static void fq_codel_reset(struct Qdisc
35 memset(q->backlogs, 0, q->flows_cnt * sizeof(u32));
37 + q->memory_usage = 0;
40 static const struct nla_policy fq_codel_policy[TCA_FQ_CODEL_MAX + 1] = {