linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Wagner <dwagner@suse.de>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	Daniel Wagner <dwagner@suse.de>
Subject: [RFC] block: Allocate only 1 tag set for a kdump kernel
Date: Tue, 28 Jul 2020 13:08:09 +0200	[thread overview]
Message-ID: <20200728110809.19228-1-dwagner@suse.de> (raw)

Do not update nr_hw_queues again after setting it to 1 for a kdump
kernel. This avoids allocating a tag set of size nr_cpu_ids and but
then just using one tag set.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
Hi,

I stumbled across this and didn't make sense to me that we might
allocated more tag sets than we potently use. But maybe I am
not seeing the obvious thing.

Only compiled tested.

Thanks,
Daniel

 block/blk-mq.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 4f57d27bfa73..e32cb0217135 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -3291,13 +3291,14 @@ int blk_mq_alloc_tag_set(struct blk_mq_tag_set *set)
 		set->nr_hw_queues = 1;
 		set->nr_maps = 1;
 		set->queue_depth = min(64U, set->queue_depth);
+	} else {
+		/*
+		 * There is no use for more h/w queues than cpus
+		 * if we just have a single map
+		 */
+		if (set->nr_maps == 1 && set->nr_hw_queues > nr_cpu_ids)
+			set->nr_hw_queues = nr_cpu_ids;
 	}
-	/*
-	 * There is no use for more h/w queues than cpus if we just have
-	 * a single map
-	 */
-	if (set->nr_maps == 1 && set->nr_hw_queues > nr_cpu_ids)
-		set->nr_hw_queues = nr_cpu_ids;
 
 	if (blk_mq_realloc_tag_set_tags(set, 0, set->nr_hw_queues) < 0)
 		return -ENOMEM;
@@ -3309,7 +3310,7 @@ int blk_mq_alloc_tag_set(struct blk_mq_tag_set *set)
 						  GFP_KERNEL, set->numa_node);
 		if (!set->map[i].mq_map)
 			goto out_free_mq_map;
-		set->map[i].nr_queues = is_kdump_kernel() ? 1 : set->nr_hw_queues;
+		set->map[i].nr_queues = set->nr_hw_queues;
 	}
 
 	ret = blk_mq_update_queue_map(set);
-- 
2.16.4


                 reply	other threads:[~2020-07-28 11:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20200728110809.19228-1-dwagner@suse.de \
    --to=dwagner@suse.de \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).