All of lore.kernel.org
 help / color / mirror / Atom feed
From: Asias He <asias@redhat.com>
To: Tejun Heo <tj@kernel.org>
Cc: Jens Axboe <axboe@kernel.dk>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] block: Avoid missed wakeup in request waitqueue
Date: Tue, 29 May 2012 09:16:32 +0800	[thread overview]
Message-ID: <4FC42370.600@redhat.com> (raw)
In-Reply-To: <20120528102614.GC15202@dhcp-172-17-108-109.mtv.corp.google.com>

On 05/28/2012 06:26 PM, Tejun Heo wrote:
> On Mon, May 28, 2012 at 12:19:03PM +0800, Asias He wrote:
>> diff --git a/block/blk-core.c b/block/blk-core.c
>> index 1f61b74..1a45877 100644
>> --- a/block/blk-core.c
>> +++ b/block/blk-core.c
>> @@ -359,9 +359,10 @@ EXPORT_SYMBOL(blk_put_queue);
>>    */
>>   void blk_drain_queue(struct request_queue *q, bool drain_all)
>>   {
>> +	int i;
>> +
>>   	while (true) {
>>   		bool drain = false;
>> -		int i;
>>
>>   		spin_lock_irq(q->queue_lock);
>>
>> @@ -400,6 +401,14 @@ void blk_drain_queue(struct request_queue *q, bool drain_all)
>>   			break;
>>   		msleep(10);
>>   	}
>> +
>> +	/* Wake up threads which are sleeping on get_request() */
>> +	spin_lock_irq(q->queue_lock);
>> +	for (i = 0; i<  ARRAY_SIZE(q->rq.wait); i++) {
>> +		if (waitqueue_active(&q->rq.wait[i]))
>> +			wake_up_all(&q->rq.wait[i]);
>> +	}
>> +	spin_unlock_irq(q->queue_lock);
>
> I don't think we need waitqueue_active() optimization here.  Let's
> just do,
>
> 	/* please explain why this is necessary */
> 	for (i = 0; i<  ARRAY_SIZE(q->rq.wait); i++)
> 		wake_up_all(&q->rq.wait[i]);

OK. V2 is on its way.


-- 
Asias

      parent reply	other threads:[~2012-05-29  1:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-28  4:19 [PATCH] block: Avoid missed wakeup in request waitqueue Asias He
2012-05-28 10:26 ` Tejun Heo
2012-05-29  1:15   ` [PATCH V2] " Asias He
2012-05-29  1:21     ` Tejun Heo
2012-06-06  2:14       ` Asias He
2012-05-29  1:16   ` Asias He [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FC42370.600@redhat.com \
    --to=asias@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.