public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] blk-mq: don't change nr_hw_queues and nr_maps for kdump kernel
@ 2024-02-28  4:08 Ming Lei
  2024-02-28 13:24 ` Christoph Hellwig
  2024-02-28 14:22 ` Jens Axboe
  0 siblings, 2 replies; 3+ messages in thread
From: Ming Lei @ 2024-02-28  4:08 UTC (permalink / raw)
  To: Jens Axboe, linux-block; +Cc: Christoph Hellwig, Ming Lei, Wen Xiong

For most of ARCHs, 'nr_cpus=1' is passed for kdump kernel, so
nr_hw_queues for each mapping is supposed to be 1 already.

More importantly, this way may cause trouble for driver, because blk-mq and
driver see different queue mapping since driver should setup hardware
queue setting before calling into allocating blk-mq tagset.

So not overriding nr_hw_queues and nr_maps for kdump kernel.

Cc: Wen Xiong <wenxiong@us.ibm.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
 block/blk-mq.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 6abb4ce46baa..be5f6380d46d 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -4391,7 +4391,7 @@ static void blk_mq_update_queue_map(struct blk_mq_tag_set *set)
 	if (set->nr_maps == 1)
 		set->map[HCTX_TYPE_DEFAULT].nr_queues = set->nr_hw_queues;
 
-	if (set->ops->map_queues && !is_kdump_kernel()) {
+	if (set->ops->map_queues) {
 		int i;
 
 		/*
@@ -4490,14 +4490,12 @@ int blk_mq_alloc_tag_set(struct blk_mq_tag_set *set)
 
 	/*
 	 * If a crashdump is active, then we are potentially in a very
-	 * memory constrained environment. Limit us to 1 queue and
-	 * 64 tags to prevent using too much memory.
+	 * memory constrained environment. Limit us to  64 tags to prevent
+	 * using too much memory.
 	 */
-	if (is_kdump_kernel()) {
-		set->nr_hw_queues = 1;
-		set->nr_maps = 1;
+	if (is_kdump_kernel())
 		set->queue_depth = min(64U, set->queue_depth);
-	}
+
 	/*
 	 * There is no use for more h/w queues than cpus if we just have
 	 * a single map
@@ -4527,7 +4525,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;
 	}
 
 	blk_mq_update_queue_map(set);
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] blk-mq: don't change nr_hw_queues and nr_maps for kdump kernel
  2024-02-28  4:08 [PATCH] blk-mq: don't change nr_hw_queues and nr_maps for kdump kernel Ming Lei
@ 2024-02-28 13:24 ` Christoph Hellwig
  2024-02-28 14:22 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2024-02-28 13:24 UTC (permalink / raw)
  To: Ming Lei; +Cc: Jens Axboe, linux-block, Christoph Hellwig, Wen Xiong

On Wed, Feb 28, 2024 at 12:08:57PM +0800, Ming Lei wrote:
> For most of ARCHs, 'nr_cpus=1' is passed for kdump kernel, so
> nr_hw_queues for each mapping is supposed to be 1 already.
> 
> More importantly, this way may cause trouble for driver, because blk-mq and
> driver see different queue mapping since driver should setup hardware
> queue setting before calling into allocating blk-mq tagset.
> 
> So not overriding nr_hw_queues and nr_maps for kdump kernel.

Great to see this hack retired.

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] blk-mq: don't change nr_hw_queues and nr_maps for kdump kernel
  2024-02-28  4:08 [PATCH] blk-mq: don't change nr_hw_queues and nr_maps for kdump kernel Ming Lei
  2024-02-28 13:24 ` Christoph Hellwig
@ 2024-02-28 14:22 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2024-02-28 14:22 UTC (permalink / raw)
  To: linux-block, Ming Lei; +Cc: Christoph Hellwig, Wen Xiong


On Wed, 28 Feb 2024 12:08:57 +0800, Ming Lei wrote:
> For most of ARCHs, 'nr_cpus=1' is passed for kdump kernel, so
> nr_hw_queues for each mapping is supposed to be 1 already.
> 
> More importantly, this way may cause trouble for driver, because blk-mq and
> driver see different queue mapping since driver should setup hardware
> queue setting before calling into allocating blk-mq tagset.
> 
> [...]

Applied, thanks!

[1/1] blk-mq: don't change nr_hw_queues and nr_maps for kdump kernel
      commit: ec30b461f3d067bd322a6c3a6c5105746ed9bf14

Best regards,
-- 
Jens Axboe




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-02-28 14:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-28  4:08 [PATCH] blk-mq: don't change nr_hw_queues and nr_maps for kdump kernel Ming Lei
2024-02-28 13:24 ` Christoph Hellwig
2024-02-28 14:22 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox