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
Subject: Re: [RFC PATCH 2/5] block: Do not stop draining if waitqueue is not empty.
Date: Tue, 22 May 2012 14:48:55 +0800	[thread overview]
Message-ID: <4FBB36D7.9030202@redhat.com> (raw)
In-Reply-To: <20120521153922.GA6549@google.com>

On 05/21/2012 11:39 PM, Tejun Heo wrote:
> On Mon, May 21, 2012 at 05:08:30PM +0800, Asias He wrote:
>> If there are processes still in the wait queue, keep draining,
>> otherwise these processes would be in D state forever.
>>
>> I noticed this situation:
>> q->rq.count[0] == 0, q->rq.count[1] == 0, however wait queue
>> q->rq.wait[0].task_list and q->rq.wait[1].task_list are not empty.
>>
>> Cc: Jens Axboe<axboe@kernel.dk>
>> Cc: Tejun Heo<tj@kernel.org>
>> Cc: linux-fsdevel@vger.kernel.org
>> Signed-off-by: Asias He<asias@redhat.com>
>> ---
>>   block/blk-core.c |    1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/block/blk-core.c b/block/blk-core.c
>> index ca42fd7..2c2b585 100644
>> --- a/block/blk-core.c
>> +++ b/block/blk-core.c
>> @@ -394,6 +394,7 @@ void blk_drain_queue(struct request_queue *q, bool drain_all)
>>   				drain |= q->rq.count[i];
>>   				drain |= q->in_flight[i];
>>   				drain |= !list_empty(&q->flush_queue[i]);
>> +				drain |= waitqueue_active(&q->rq.wait[i]);
>
> Hmm... how does that happen?  What do you mean "you noticed this
> situation"?  Did that actually happen or you noticed such scenarios
> would be possible?  If rl.wait[] isn't empty with zero rq count, the
> queue would hang, so we should be fixing that situation instead of
> working around it from cleanup_queue.

Hi, Tejun

I actually saw this happened though it should not happen. I have no idea 
why this happens. Maybe unbalanced prepare_to_wait_exclusive() in 
get_request_wait() and wake_up() in __freed_request()?

With this happened, I saw some fio threads in D state which are sleeping 
on get_request_wait(). If I wake up the threads in the wait queue in 
q->abort_queue_fn() callback which i proposed in the 1/5 of this patch 
set, the queue cleanup and thus hot-unplug went pretty well. (Passed 
3000~ rounds of test, without this 2~ round of test would fail). See 
this patch [RFC PATCH 4/5] virtio-blk: Use q->abort_queue_fn() to abort.

-- 
Asias

  reply	other threads:[~2012-05-22  6:48 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-21  9:08 [RFC PATCH 1/5] block: Introduce q->abort_queue_fn() Asias He
2012-05-21  9:08 ` [RFC PATCH 2/5] block: Do not stop draining if waitqueue is not empty Asias He
2012-05-21 15:39   ` Tejun Heo
2012-05-22  6:48     ` Asias He [this message]
2012-05-22 15:07       ` Tejun Heo
2012-05-23 14:54         ` Asias He
2012-05-25  1:16           ` Asias He
2012-05-28  0:30             ` Tejun Heo
2012-05-28  3:39               ` Asias He
2012-05-21  9:08 ` [RFC PATCH 3/5] virtio-blk: Call del_gendisk() before disable guest kick Asias He
2012-05-21  9:08 ` [RFC PATCH 4/5] virtio-blk: Use q->abort_queue_fn() to abort requests Asias He
2012-05-21  9:08 ` [RFC PATCH 5/5] virtio-blk: Use block layer provided spinlock Asias He
2012-05-21 20:59   ` Michael S. Tsirkin
2012-05-22  8:22     ` Asias He
2012-05-21 15:42 ` [RFC PATCH 1/5] block: Introduce q->abort_queue_fn() Tejun Heo
2012-05-22  7:30   ` Asias He
2012-05-22 15:14     ` Tejun Heo
2012-05-23 15:04       ` Asias He

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=4FBB36D7.9030202@redhat.com \
    --to=asias@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=linux-fsdevel@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.