Subject: Re: Question about locks in qdisc_restart

From: Eric Dumazet <[email-masked]>
Date: Mon, 27 Apr 2009 22:20:29 +0200

Tom Herbert a écrit :
> In qdisc_restart the qdisc lock is released before taking the
> netif_tx_lock, and only acquired again after unlocking the
> netif_tx_lock.  There's a comment with the function that
> "qdisc_lock(q) and netif_tx_lock are mutually exclusive, if one is
> grabbed, another must be free."  Can anyone tell me the motivation for
> this restriction?  We are seeing some performance improvements by
> holding the lock through qdisc_restart, and I'm not sure why this
> would be bad to do.
> 

Well, motivation is to let other users (cpus) have a chance getting the lock :)

Do you see performance improvements too if using spin_is_contended()
to break the __qdisc_run loop ?

if (need_resched() || jiffies != start_time || spin_is_contended(qdisc_lock(q))

(And removing the unlock/lock in qdisc_restart() as you did)