All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ming Lei <ming.lei@redhat.com>
To: Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org,
	Christoph Hellwig <hch@infradead.org>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>,
	Stefan Haberland <sth@linux.vnet.ibm.com>,
	Ming Lei <ming.lei@redhat.com>, Christoph Hellwig <hch@lst.de>
Subject: [PATCH 8/8] blk-mq: remove code for dealing with remapping queue
Date: Sun,  8 Apr 2018 17:48:14 +0800	[thread overview]
Message-ID: <20180408094814.28953-9-ming.lei@redhat.com> (raw)
In-Reply-To: <20180408094814.28953-1-ming.lei@redhat.com>

Firstly, from commit 4b855ad37194 ("blk-mq: Create hctx for each present CPU),
blk-mq doesn't remap queue any more after CPU topo is changed.

Secondly, set->nr_hw_queues can't be bigger than nr_cpu_ids, and now we map
all possible CPUs to hw queues, so at least one CPU is mapped to each hctx.

So queue mapping has became static and fixed just like percpu variable, and
we don't need to handle queue remapping any more.

Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Stefan Haberland <sth@linux.vnet.ibm.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
 block/blk-mq.c | 34 +++-------------------------------
 1 file changed, 3 insertions(+), 31 deletions(-)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 3b4ce83a0ba2..c3964a79638e 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -2330,7 +2330,7 @@ static void blk_mq_free_map_and_requests(struct blk_mq_tag_set *set,
 
 static void blk_mq_map_swqueue(struct request_queue *q)
 {
-	unsigned int i, hctx_idx;
+	unsigned int i;
 	struct blk_mq_hw_ctx *hctx;
 	struct blk_mq_ctx *ctx;
 	struct blk_mq_tag_set *set = q->tag_set;
@@ -2347,23 +2347,8 @@ static void blk_mq_map_swqueue(struct request_queue *q)
 
 	/*
 	 * Map software to hardware queues.
-	 *
-	 * If the cpu isn't present, the cpu is mapped to first hctx.
 	 */
 	for_each_possible_cpu(i) {
-		hctx_idx = q->mq_map[i];
-		/* unmapped hw queue can be remapped after CPU topo changed */
-		if (!set->tags[hctx_idx] &&
-		    !__blk_mq_alloc_rq_map(set, hctx_idx)) {
-			/*
-			 * If tags initialization fail for some hctx,
-			 * that hctx won't be brought online.  In this
-			 * case, remap the current ctx to hctx[0] which
-			 * is guaranteed to always have tags allocated
-			 */
-			q->mq_map[i] = 0;
-		}
-
 		ctx = per_cpu_ptr(q->queue_ctx, i);
 		hctx = blk_mq_map_queue(q, i);
 
@@ -2375,21 +2360,8 @@ static void blk_mq_map_swqueue(struct request_queue *q)
 	mutex_unlock(&q->sysfs_lock);
 
 	queue_for_each_hw_ctx(q, hctx, i) {
-		/*
-		 * If no software queues are mapped to this hardware queue,
-		 * disable it and free the request entries.
-		 */
-		if (!hctx->nr_ctx) {
-			/* Never unmap queue 0.  We need it as a
-			 * fallback in case of a new remap fails
-			 * allocation
-			 */
-			if (i && set->tags[i])
-				blk_mq_free_map_and_requests(set, i);
-
-			hctx->tags = NULL;
-			continue;
-		}
+		/* every hctx should get mapped by at least one CPU */
+		WARN_ON(!hctx->nr_ctx);
 
 		hctx->tags = set->tags[i];
 		WARN_ON(!hctx->tags);
-- 
2.9.5

  parent reply	other threads:[~2018-04-08  9:48 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-08  9:48 [PATCH 0/8] blk-mq: fix and improve queue mapping Ming Lei
2018-04-08  9:48 ` [PATCH 1/8] blk-mq: make sure that correct hctx->next_cpu is set Ming Lei
2018-04-09 10:04   ` Christoph Hellwig
2018-04-09 11:02   ` Sagi Grimberg
2018-04-08  9:48 ` [PATCH 2/8] blk-mq: don't keep offline CPUs mapped to hctx 0 Ming Lei
2018-04-09 10:04   ` Christoph Hellwig
2018-04-09 11:02   ` Sagi Grimberg
2018-04-08  9:48 ` [PATCH 3/8] blk-mq: avoid to write intermediate result to hctx->next_cpu Ming Lei
2018-04-09 10:05   ` Christoph Hellwig
2018-04-09 11:02   ` Sagi Grimberg
2018-04-08  9:48 ` [PATCH 4/8] blk-mq: introduce blk_mq_hw_queue_first_cpu() to figure out first cpu Ming Lei
2018-04-09 10:06   ` Christoph Hellwig
2018-04-09 11:02   ` Sagi Grimberg
2018-04-08  9:48 ` [PATCH 5/8] blk-mq: remove blk_mq_delay_queue() Ming Lei
2018-04-09 10:06   ` Christoph Hellwig
2018-04-09 11:03   ` Sagi Grimberg
2018-04-08  9:48 ` [PATCH 6/8] blk-mq: don't check queue mapped in __blk_mq_delay_run_hw_queue() Ming Lei
2018-04-09 10:07   ` Christoph Hellwig
2018-04-09 11:03   ` Sagi Grimberg
2018-04-08  9:48 ` [PATCH 7/8] blk-mq: reimplement blk_mq_hw_queue_mapped Ming Lei
2018-04-09 10:08   ` Christoph Hellwig
2018-04-09 11:03   ` Sagi Grimberg
2018-04-08  9:48 ` Ming Lei [this message]
2018-04-09 10:09   ` [PATCH 8/8] blk-mq: remove code for dealing with remapping queue Christoph Hellwig
2018-04-09 11:03   ` Sagi Grimberg
2018-04-09 10:13 ` [PATCH 0/8] blk-mq: fix and improve queue mapping Christian Borntraeger
2018-04-09 15:00 ` Jens Axboe
2018-04-09 15:48 ` Stefan Haberland

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=20180408094814.28953-9-ming.lei@redhat.com \
    --to=ming.lei@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=borntraeger@de.ibm.com \
    --cc=hch@infradead.org \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    --cc=sth@linux.vnet.ibm.com \
    /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.