[NET_SCHED] qdisc: avoid transmit softirq on watchdog wakeup
authorStephen Hemminger <shemminger@linux-foundation.org>
Thu, 22 Mar 2007 19:18:35 +0000 (12:18 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Thu, 26 Apr 2007 05:27:23 +0000 (22:27 -0700)
If possible, avoid having to do a transmit softirq when a qdisc
watchdog decides to re-enable.  The watchdog routine runs off
a timer, so it is already in the same effective context as
the softirq.

Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/sch_api.c

index fcaa4ad..5873250 100644 (file)
@@ -296,10 +296,16 @@ static enum hrtimer_restart qdisc_watchdog(struct hrtimer *timer)
 {
        struct qdisc_watchdog *wd = container_of(timer, struct qdisc_watchdog,
                                                 timer);
+       struct net_device *dev = wd->qdisc->dev;
 
        wd->qdisc->flags &= ~TCQ_F_THROTTLED;
        smp_wmb();
-       netif_schedule(wd->qdisc->dev);
+       if (spin_trylock(&dev->queue_lock)) {
+               qdisc_run(dev);
+               spin_unlock(&dev->queue_lock);
+       } else
+               netif_schedule(dev);
+
        return HRTIMER_NORESTART;
 }