All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org, Christoph Hellwig <hch@lst.de>,
	Bart Van Assche <bvanassche@acm.org>,
	Christoph Hellwig <hch@infradead.org>,
	Hannes Reinecke <hare@suse.com>,
	James Smart <james.smart@broadcom.com>,
	Ming Lei <ming.lei@redhat.com>,
	Jianchao Wang <jianchao.w.wang@oracle.com>,
	Dongli Zhang <dongli.zhang@oracle.com>,
	stable@vger.kernel.org
Subject: [PATCH 4/4] block: Make blk_cleanup_queue() faster
Date: Mon,  1 Apr 2019 14:20:14 -0700	[thread overview]
Message-ID: <20190401212014.192753-5-bvanassche@acm.org> (raw)
In-Reply-To: <20190401212014.192753-1-bvanassche@acm.org>

Since blk_cleanup_queue() waits until q->q_usage_counter drops to zero
before setting the "dead" flag, it is guaranteed that all requests that
were in progress when blk_cleanup_queue() was called have finished before
the "dead" flag is set. This means it is not possible that any .queue_rq()
call is ongoing while the "dead" flag is set. Hence remove the code that
waits for ongoing .queue_rq() calls to finish after the "dead" flag has
been set. See also commit c2856ae2f315 ("blk-mq: quiesce queue before
freeing queue") # v4.16.

Cc: Christoph Hellwig <hch@infradead.org>
Cc: Hannes Reinecke <hare@suse.com>
Cc: James Smart <james.smart@broadcom.com>
Cc: Ming Lei <ming.lei@redhat.com>
Cc: Jianchao Wang <jianchao.w.wang@oracle.com>
Cc: Dongli Zhang <dongli.zhang@oracle.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 block/blk-core.c | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index bfdbdbb8ec65..2921af6f8d33 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -348,18 +348,6 @@ void blk_cleanup_queue(struct request_queue *q)
 
 	blk_queue_flag_set(QUEUE_FLAG_DEAD, q);
 
-	/*
-	 * make sure all in-progress dispatch are completed because
-	 * blk_freeze_queue() can only complete all requests, and
-	 * dispatch may still be in-progress since we dispatch requests
-	 * from more than one contexts.
-	 *
-	 * We rely on driver to deal with the race in case that queue
-	 * initialization isn't done.
-	 */
-	if (queue_is_mq(q) && blk_queue_init_done(q))
-		blk_mq_quiesce_queue(q);
-
 	/* for synchronous bio-based driver finish in-flight integrity i/o */
 	blk_flush_integrity();
 
-- 
2.21.0.196.g041f5ea1cf98


      parent reply	other threads:[~2019-04-01 21:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-01 21:20 [PATCH 0/4] Fir a race between request queue cleanup and running queues Bart Van Assche
2019-04-01 21:20 ` [PATCH 1/4] block: Move the percpu_ref_exit(&q->q_usage_counter) call into __blk_release_queue() Bart Van Assche
2019-04-01 21:20 ` [PATCH 2/4] block: Fix a race between request queue freezing and running queues Bart Van Assche
2019-04-02  0:53   ` Ming Lei
2019-04-02 15:44     ` Bart Van Assche
2019-04-03  3:31       ` Ming Lei
2019-04-01 21:20 ` [PATCH 3/4] block: Fix a comment in blk_cleanup_queue() Bart Van Assche
2019-04-01 21:20 ` Bart Van Assche [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=20190401212014.192753-5-bvanassche@acm.org \
    --to=bvanassche@acm.org \
    --cc=axboe@kernel.dk \
    --cc=dongli.zhang@oracle.com \
    --cc=hare@suse.com \
    --cc=hch@infradead.org \
    --cc=hch@lst.de \
    --cc=james.smart@broadcom.com \
    --cc=jianchao.w.wang@oracle.com \
    --cc=linux-block@vger.kernel.org \
    --cc=ming.lei@redhat.com \
    --cc=stable@vger.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.