Re: [PATCH] blk-mq: only run mapped hw queues in blk_mq_run_hw_queues()

Jens Axboe
2018-03-28T14:53:02Z

On 3/28/18 8:38 AM, Jens Axboe wrote:
> On 3/28/18 1:45 AM, Christian Borntraeger wrote:
>> FWIW, this patch does not fix the issue for me:
>
> Looks like I didn't do the delayed path. How about the below?

OK, final version... This is more in line with what I originally
suggested.

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 16e83e6df404..c90016c36a70 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -1306,6 +1306,10 @@ static void __blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx)
{
int srcu_idx;

+ if (!blk_mq_hw_queue_mapped(hctx) &&
+ !WARN_ON_ONCE(blk_mq_hctx_has_pending(hctx)))
+ return;
+
/*
* We should be running this queue from one of the CPUs that
* are mapped to it.
@@ -1399,9 +1403,6 @@ static int blk_mq_hctx_next_cpu(struct blk_mq_hw_ctx *hctx)
static void __blk_mq_delay_run_hw_queue(struct blk_mq_hw_ctx *hctx, bool async,
unsigned long msecs)
{
- if (WARN_ON_ONCE(!blk_mq_hw_queue_mapped(hctx)))
- return;
-
if (unlikely(blk_mq_hctx_stopped(hctx)))
return;

@@ -1586,9 +1587,6 @@ static void blk_mq_run_work_fn(struct work_struct *work)

void blk_mq_delay_queue(struct blk_mq_hw_ctx *hctx, unsigned long msecs)
{
- if (WARN_ON_ONCE(!blk_mq_hw_queue_mapped(hctx)))
- return;
-
/*
* Stop the hw queue, then modify currently delayed work.
* This should prevent us from running the queue prematurely.

--
Jens Axboe