From mboxrd@z Thu Jan 1 00:00:00 1970 From: Asias He Subject: Re: [PATCH V3] block: Mitigate lock unbalance caused by lock switching Date: Wed, 30 May 2012 14:28:05 +0800 Message-ID: <4FC5BDF5.2040000@redhat.com> References: <20120528102214.GB15202@dhcp-172-17-108-109.mtv.corp.google.com> <1338255542-22247-1-git-send-email-asias@redhat.com> <4FC4D2F2.2070309@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: Jens Axboe , Tejun Heo , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, tim.gardner@canonical.com To: Tim Gardner Return-path: In-Reply-To: <4FC4D2F2.2070309@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On 05/29/2012 09:45 PM, Tim Gardner wrote: > On 05/28/2012 07:39 PM, Asias He wrote: > > > >> @@ -440,6 +435,11 @@ void blk_cleanup_queue(struct request_queue *q) >> del_timer_sync(&q->backing_dev_info.laptop_mode_wb_timer); >> blk_sync_queue(q); >> >> + spin_lock_irq(lock); >> + if (q->queue_lock !=&q->__queue_lock) >> + q->queue_lock =&q->__queue_lock; >> + spin_unlock_irq(lock); >> + > > Isn't the 'if' clause superfluous ? You could just do the assignment, e.g., > > + spin_lock_irq(lock); > + q->queue_lock =&q->__queue_lock; > + spin_unlock_irq(lock); Well, this saves a if clause but adds an unnecessary assignment if the lock is already internal lock. -- Asias