034-fq_codel-fix-memory-limitation-drift.patch 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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
  4. memory_usage must be decreased in dequeue_func(), not in
  5. fq_codel_dequeue(), otherwise packets dropped by Codel algo
  6. are missing this decrease.
  7. Also we need to clear memory_usage in fq_codel_reset()
  8. Fixes: 95b58430abe7 ("fq_codel: add memory limitation per queue")
  9. Signed-off-by: Eric Dumazet <edumazet@google.com>
  10. ---
  11. --- a/net/sched/sch_fq_codel.c
  12. +++ b/net/sched/sch_fq_codel.c
  13. @@ -259,6 +259,7 @@ static struct sk_buff *dequeue(struct co
  14. if (flow->head) {
  15. skb = dequeue_head(flow);
  16. q->backlogs[flow - q->flows] -= qdisc_pkt_len(skb);
  17. + q->memory_usage -= skb->truesize;
  18. sch->q.qlen--;
  19. }
  20. return skb;
  21. @@ -306,7 +307,6 @@ begin:
  22. list_del_init(&flow->flowchain);
  23. goto begin;
  24. }
  25. - q->memory_usage -= skb->truesize;
  26. qdisc_bstats_update(sch, skb);
  27. flow->deficit -= qdisc_pkt_len(skb);
  28. /* We cant call qdisc_tree_reduce_backlog() if our qlen is 0,
  29. @@ -343,6 +343,7 @@ static void fq_codel_reset(struct Qdisc
  30. }
  31. memset(q->backlogs, 0, q->flows_cnt * sizeof(u32));
  32. sch->q.qlen = 0;
  33. + q->memory_usage = 0;
  34. }
  35. static const struct nla_policy fq_codel_policy[TCA_FQ_CODEL_MAX + 1] = {