657-qdisc_reduce_truesize.patch 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. Reduce skb size under load when queues begin to fill on the
  6. commont qdiscs.
  7. ---
  8. net/sched/sch_codel.c | 2 ++
  9. net/sched/sch_fifo.c | 12 ++++++++----
  10. net/sched/sch_fq_codel.c | 2 ++
  11. 3 files changed, 12 insertions(+), 4 deletions(-)
  12. --- a/net/sched/sch_codel.c
  13. +++ b/net/sched/sch_codel.c
  14. @@ -97,6 +97,8 @@ static int codel_qdisc_enqueue(struct sk
  15. struct codel_sched_data *q;
  16. if (likely(qdisc_qlen(sch) < sch->limit)) {
  17. + if(qdisc_qlen(sch) > 128)
  18. + skb = skb_reduce_truesize(skb);
  19. codel_set_enqueue_time(skb);
  20. return qdisc_enqueue_tail(skb, sch);
  21. }
  22. --- a/net/sched/sch_fifo.c
  23. +++ b/net/sched/sch_fifo.c
  24. @@ -29,17 +29,21 @@ static int bfifo_enqueue(struct sk_buff
  25. static int pfifo_enqueue(struct sk_buff *skb, struct Qdisc *sch)
  26. {
  27. - if (likely(skb_queue_len(&sch->q) < sch->limit))
  28. + if (likely(skb_queue_len(&sch->q) < sch->limit)) {
  29. + if (skb_queue_len(&sch->q) > 128)
  30. + skb = skb_reduce_truesize(skb);
  31. return qdisc_enqueue_tail(skb, sch);
  32. -
  33. + }
  34. return qdisc_reshape_fail(skb, sch);
  35. }
  36. static int pfifo_tail_enqueue(struct sk_buff *skb, struct Qdisc *sch)
  37. {
  38. - if (likely(skb_queue_len(&sch->q) < sch->limit))
  39. + if (likely(skb_queue_len(&sch->q) < sch->limit)) {
  40. + if (skb_queue_len(&sch->q) > 128)
  41. + skb = skb_reduce_truesize(skb);
  42. return qdisc_enqueue_tail(skb, sch);
  43. -
  44. + }
  45. /* queue full, remove one skb to fulfill the limit */
  46. __qdisc_queue_drop_head(sch, &sch->q);
  47. qdisc_qstats_drop(sch);
  48. --- a/net/sched/sch_fq_codel.c
  49. +++ b/net/sched/sch_fq_codel.c
  50. @@ -185,6 +185,8 @@ static int fq_codel_enqueue(struct sk_bu
  51. return ret;
  52. }
  53. idx--;
  54. + if (sch->q.qlen > 128)
  55. + skb = skb_reduce_truesize(skb);
  56. codel_set_enqueue_time(skb);
  57. flow = &q->flows[idx];