> -----Original Message----- > From: linux-scsi-ow...@vger.kernel.org [mailto:linux-scsi- > ow...@vger.kernel.org] On Behalf Of James Bottomley > Sent: Friday, April 17, 2015 4:43 PM > To: Christoph Hellwig > Cc: linux-scsi@vger.kernel.org; ax...@kernel.dk > Subject: Re: [PATCH, RFC] scsi: use host wide tags by default > > On Fri, 2015-04-17 at 22:11 +0200, Christoph Hellwig wrote: ... > > + spin_lock_irqsave(sdev->request_queue->queue_lock, flags); > > + sdev->queue_depth = depth; > > + spin_unlock_irqrestore(sdev->request_queue->queue_lock, flags); > > This lock/unlock is a nasty global sync point which can be eliminated: > we can rely on the architectural atomicity of 32 bit writes (might need > to make sdev->queue_depth a u32 because I seem to remember 16 bit writes > had to be done as two byte stores on some architectures).
If such a change is made, consider using atomic_set (for an int) or atomic64_set (for a 64-bit value) plus a barrier when needed. That communicates the need for atomicity but reduces to a plain store if the architecture always handles that width atomically. I don't think there is an atomic_set_short for a short, though. --- Robert Elliott, HP Server Storage