* [PATCH 1/8] blk-mq: make sure that correct hctx->next_cpu is set
[not found] <20180408094814.28953-1-ming.lei@redhat.com>
@ 2018-04-08 9:48 ` 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
1 sibling, 2 replies; 6+ messages in thread
From: Ming Lei @ 2018-04-08 9:48 UTC (permalink / raw)
To: Jens Axboe, linux-block, Christoph Hellwig
Cc: Christian Borntraeger, Stefan Haberland, Ming Lei,
Christoph Hellwig, stable
>From commit 20e4d81393196 (blk-mq: simplify queue mapping & schedule
with each possisble CPU), one hctx can be mapped from all offline CPUs,
then hctx->next_cpu can be set as wrong.
This patch fixes this issue by making hctx->next_cpu pointing to the
first CPU in hctx->cpumask if all CPUs in hctx->cpumask are offline.
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Stefan Haberland <sth@linux.vnet.ibm.com>
Fixes: 20e4d81393196 ("blk-mq: simplify queue mapping & schedule with each possisble CPU")
Cc: stable@vger.kernel.org
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
block/blk-mq.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/block/blk-mq.c b/block/blk-mq.c
index f5c7dbcb954f..9b220dc415ac 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -2432,6 +2432,8 @@ static void blk_mq_map_swqueue(struct request_queue *q)
*/
hctx->next_cpu = cpumask_first_and(hctx->cpumask,
cpu_online_mask);
+ if (hctx->next_cpu >= nr_cpu_ids)
+ hctx->next_cpu = cpumask_first(hctx->cpumask);
hctx->next_cpu_batch = BLK_MQ_CPU_WORK_BATCH;
}
}
--
2.9.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/8] blk-mq: don't keep offline CPUs mapped to hctx 0
[not found] <20180408094814.28953-1-ming.lei@redhat.com>
2018-04-08 9:48 ` [PATCH 1/8] blk-mq: make sure that correct hctx->next_cpu is set Ming Lei
@ 2018-04-08 9:48 ` Ming Lei
2018-04-09 10:04 ` Christoph Hellwig
2018-04-09 11:02 ` Sagi Grimberg
1 sibling, 2 replies; 6+ messages in thread
From: Ming Lei @ 2018-04-08 9:48 UTC (permalink / raw)
To: Jens Axboe, linux-block, Christoph Hellwig
Cc: Christian Borntraeger, Stefan Haberland, Ming Lei,
Christoph Hellwig, Keith Busch, stable
>From commit 4b855ad37194 ("blk-mq: Create hctx for each present CPU),
blk-mq doesn't remap queue after CPU topo is changed, that said when
some of these offline CPUs become online, they are still mapped to
hctx 0, then hctx 0 may become the bottleneck of IO dispatch and
completion.
This patch sets up the mapping from the beginning, and aligns to
queue mapping for PCI device (blk_mq_pci_map_queues()).
Fixes: 4b855ad37194 ("blk-mq: Create hctx for each present CPU)
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Stefan Haberland <sth@linux.vnet.ibm.com>
Cc: Keith Busch <keith.busch@intel.com>
Cc: stable@vger.kernel.org
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
block/blk-mq-cpumap.c | 5 -----
1 file changed, 5 deletions(-)
diff --git a/block/blk-mq-cpumap.c b/block/blk-mq-cpumap.c
index 9f8cffc8a701..3eb169f15842 100644
--- a/block/blk-mq-cpumap.c
+++ b/block/blk-mq-cpumap.c
@@ -16,11 +16,6 @@
static int cpu_to_queue_index(unsigned int nr_queues, const int cpu)
{
- /*
- * Non present CPU will be mapped to queue index 0.
- */
- if (!cpu_present(cpu))
- return 0;
return cpu % nr_queues;
}
--
2.9.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/8] blk-mq: make sure that correct hctx->next_cpu is set
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
1 sibling, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2018-04-09 10:04 UTC (permalink / raw)
To: Ming Lei
Cc: Jens Axboe, linux-block, Christian Borntraeger, Stefan Haberland,
stable
On Sun, Apr 08, 2018 at 05:48:07PM +0800, Ming Lei wrote:
> >From commit 20e4d81393196 (blk-mq: simplify queue mapping & schedule
> with each possisble CPU), one hctx can be mapped from all offline CPUs,
> then hctx->next_cpu can be set as wrong.
>
> This patch fixes this issue by making hctx->next_cpu pointing to the
> first CPU in hctx->cpumask if all CPUs in hctx->cpumask are offline.
Looks good,
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/8] blk-mq: don't keep offline CPUs mapped to hctx 0
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
1 sibling, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2018-04-09 10:04 UTC (permalink / raw)
To: Ming Lei
Cc: Jens Axboe, linux-block, Christian Borntraeger, Stefan Haberland,
Keith Busch, stable
On Sun, Apr 08, 2018 at 05:48:08PM +0800, Ming Lei wrote:
> >From commit 4b855ad37194 ("blk-mq: Create hctx for each present CPU),
> blk-mq doesn't remap queue after CPU topo is changed, that said when
> some of these offline CPUs become online, they are still mapped to
> hctx 0, then hctx 0 may become the bottleneck of IO dispatch and
> completion.
>
> This patch sets up the mapping from the beginning, and aligns to
> queue mapping for PCI device (blk_mq_pci_map_queues()).
Please kill the now pointless cpu_to_queue_index function.
Otherwise looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/8] blk-mq: make sure that correct hctx->next_cpu is set
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
1 sibling, 0 replies; 6+ messages in thread
From: Sagi Grimberg @ 2018-04-09 11:02 UTC (permalink / raw)
To: Ming Lei, Jens Axboe, linux-block, Christoph Hellwig
Cc: Christian Borntraeger, Stefan Haberland, Christoph Hellwig,
stable
Looks good,
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/8] blk-mq: don't keep offline CPUs mapped to hctx 0
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
1 sibling, 0 replies; 6+ messages in thread
From: Sagi Grimberg @ 2018-04-09 11:02 UTC (permalink / raw)
To: Ming Lei, Jens Axboe, linux-block, Christoph Hellwig
Cc: Christian Borntraeger, Stefan Haberland, Christoph Hellwig,
Keith Busch, stable
Looks good,
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-04-09 11:02 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20180408094814.28953-1-ming.lei@redhat.com>
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
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).