net_sched: sch_choke: defer skb freeing
authorEric Dumazet <edumazet@google.com>
Tue, 14 Jun 2016 03:21:51 +0000 (20:21 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 15 Jun 2016 21:08:34 +0000 (14:08 -0700)
choke_reset() and choke_change() can use rtnl_qdisc_drop()
to defer expensive skb freeing after locks are released.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/sch_choke.c

index 04e0b0583e003148fc8bbd1c4c49ef179512bef5..789b69ee9e519bfd45603e08af24aa5e154a01d8 100644 (file)
@@ -375,11 +375,11 @@ static void choke_reset(struct Qdisc *sch)
                q->head = (q->head + 1) & q->tab_mask;
                if (!skb)
                        continue;
-               qdisc_qstats_backlog_dec(sch, skb);
-               --sch->q.qlen;
-               qdisc_drop(skb, sch);
+               rtnl_qdisc_drop(skb, sch);
        }
 
+       sch->q.qlen = 0;
+       sch->qstats.backlog = 0;
        memset(q->tab, 0, (q->tab_mask + 1) * sizeof(struct sk_buff *));
        q->head = q->tail = 0;
        red_restart(&q->vars);
@@ -455,7 +455,7 @@ static int choke_change(struct Qdisc *sch, struct nlattr *opt)
                                dropped += qdisc_pkt_len(skb);
                                qdisc_qstats_backlog_dec(sch, skb);
                                --sch->q.qlen;
-                               qdisc_drop(skb, sch);
+                               rtnl_qdisc_drop(skb, sch);
                        }
                        qdisc_tree_reduce_backlog(sch, oqlen - sch->q.qlen, dropped);
                        q->head = 0;