IB/qib: Optimize locking for get_txreq()
authorMike Marciniszyn <mike.marciniszyn@qlogic.com>
Fri, 23 Dec 2011 13:03:41 +0000 (08:03 -0500)
committerRoland Dreier <roland@purestorage.com>
Wed, 4 Jan 2012 04:53:31 +0000 (20:53 -0800)
commit489471095170ed1c6d0341739a243461638b0e06
treed5820187d1d24dac7526bba2dd4dafb47c1bb0b3
parenteddfb675256f49d14e8c5763098afe3eb2c93701
IB/qib: Optimize locking for get_txreq()

The current code locks the QP s_lock, followed by the pending_lock, I
guess to to protect against the allocate failing.

This patch only locks the pending_lock, assuming that the empty case
is an exeception, in which case the pending_lock is dropped, and the
original code is executed.  This will save a lock of s_lock in the
normal case.

The observation is that the sdma descriptors will deplete at twice the
rate of txreq's, so this should be rare.

Signed-off-by: Mike Marciniszyn <mike.marciniszyn@qlogic.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
drivers/infiniband/hw/qib/qib_verbs.c