All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] blk-mq: run hw queue asynchronously in blk_mq_start_hw_queues
@ 2014-06-24 14:53 Ming Lei
  2014-06-25  2:42 ` Ming Lei
  0 siblings, 1 reply; 4+ messages in thread
From: Ming Lei @ 2014-06-24 14:53 UTC (permalink / raw)
  To: Jens Axboe, linux-kernel; +Cc: Ming Lei

>From API view, it isn't good to run all hw queues synchronously
in one context, since it isn't correct for multi hw queue case.

So this patch adds 'async' parameter to blk_mq_start_hw_queue(),
and make blk_mq_start_hw_queues() to run hw queues asynchronously
at default.

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
---
 block/blk-mq.c         |    6 +++---
 include/linux/blk-mq.h |    2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 0ef2dc7..f83eacd 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -873,12 +873,12 @@ void blk_mq_stop_hw_queues(struct request_queue *q)
 }
 EXPORT_SYMBOL(blk_mq_stop_hw_queues);
 
-void blk_mq_start_hw_queue(struct blk_mq_hw_ctx *hctx)
+void blk_mq_start_hw_queue(struct blk_mq_hw_ctx *hctx, bool async)
 {
 	clear_bit(BLK_MQ_S_STOPPED, &hctx->state);
 
 	preempt_disable();
-	__blk_mq_run_hw_queue(hctx);
+	blk_mq_run_hw_queue(hctx, async);
 	preempt_enable();
 }
 EXPORT_SYMBOL(blk_mq_start_hw_queue);
@@ -889,7 +889,7 @@ void blk_mq_start_hw_queues(struct request_queue *q)
 	int i;
 
 	queue_for_each_hw_ctx(q, hctx, i)
-		blk_mq_start_hw_queue(hctx);
+		blk_mq_start_hw_queue(hctx, true);
 }
 EXPORT_SYMBOL(blk_mq_start_hw_queues);
 
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index eb726b9..49e84b5 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -169,7 +169,7 @@ void blk_mq_kick_requeue_list(struct request_queue *q);
 void blk_mq_complete_request(struct request *rq);
 
 void blk_mq_stop_hw_queue(struct blk_mq_hw_ctx *hctx);
-void blk_mq_start_hw_queue(struct blk_mq_hw_ctx *hctx);
+void blk_mq_start_hw_queue(struct blk_mq_hw_ctx *hctx, bool async);
 void blk_mq_stop_hw_queues(struct request_queue *q);
 void blk_mq_start_hw_queues(struct request_queue *q);
 void blk_mq_start_stopped_hw_queues(struct request_queue *q, bool async);
-- 
1.7.9.5


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

* Re: [PATCH] blk-mq: run hw queue asynchronously in blk_mq_start_hw_queues
  2014-06-24 14:53 [PATCH] blk-mq: run hw queue asynchronously in blk_mq_start_hw_queues Ming Lei
@ 2014-06-25  2:42 ` Ming Lei
  2014-06-25  3:00   ` Jens Axboe
  0 siblings, 1 reply; 4+ messages in thread
From: Ming Lei @ 2014-06-25  2:42 UTC (permalink / raw)
  To: Jens Axboe, Linux Kernel Mailing List; +Cc: Ming Lei

On Tue, Jun 24, 2014 at 10:53 PM, Ming Lei <tom.leiming@gmail.com> wrote:
> From API view, it isn't good to run all hw queues synchronously
> in one context, since it isn't correct for multi hw queue case.
>
> So this patch adds 'async' parameter to blk_mq_start_hw_queue(),
> and make blk_mq_start_hw_queues() to run hw queues asynchronously
> at default.

BTW, without the change, it is easy to trigger the WARN_ON() in
__blk_mq_run_hw_queue().

Thanks,
-- 
Ming Lei

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

* Re: [PATCH] blk-mq: run hw queue asynchronously in blk_mq_start_hw_queues
  2014-06-25  2:42 ` Ming Lei
@ 2014-06-25  3:00   ` Jens Axboe
  2014-06-25  4:47     ` Ming Lei
  0 siblings, 1 reply; 4+ messages in thread
From: Jens Axboe @ 2014-06-25  3:00 UTC (permalink / raw)
  To: Ming Lei, Linux Kernel Mailing List

[-- Attachment #1: Type: text/plain, Size: 659 bytes --]

On 2014-06-24 20:42, Ming Lei wrote:
> On Tue, Jun 24, 2014 at 10:53 PM, Ming Lei <tom.leiming@gmail.com> wrote:
>>  From API view, it isn't good to run all hw queues synchronously
>> in one context, since it isn't correct for multi hw queue case.
>>
>> So this patch adds 'async' parameter to blk_mq_start_hw_queue(),
>> and make blk_mq_start_hw_queues() to run hw queues asynchronously
>> at default.
>
> BTW, without the change, it is easy to trigger the WARN_ON() in
> __blk_mq_run_hw_queue().

Why not just have it call blk_mq_run_hw_queue()? Pass in async == false, 
but let the cpumask logic sort out if we need to force an async run.

-- 
Jens Axboe


[-- Attachment #2: start.patch --]
[-- Type: text/x-patch, Size: 399 bytes --]

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 0ef2dc7f01bf..ad69ef657e85 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -878,7 +878,7 @@ void blk_mq_start_hw_queue(struct blk_mq_hw_ctx *hctx)
 	clear_bit(BLK_MQ_S_STOPPED, &hctx->state);
 
 	preempt_disable();
-	__blk_mq_run_hw_queue(hctx);
+	blk_mq_run_hw_queue(hctx, false);
 	preempt_enable();
 }
 EXPORT_SYMBOL(blk_mq_start_hw_queue);

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

* Re: [PATCH] blk-mq: run hw queue asynchronously in blk_mq_start_hw_queues
  2014-06-25  3:00   ` Jens Axboe
@ 2014-06-25  4:47     ` Ming Lei
  0 siblings, 0 replies; 4+ messages in thread
From: Ming Lei @ 2014-06-25  4:47 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Linux Kernel Mailing List

On Wed, Jun 25, 2014 at 11:00 AM, Jens Axboe <axboe@kernel.dk> wrote:
> On 2014-06-24 20:42, Ming Lei wrote:
>>
>> On Tue, Jun 24, 2014 at 10:53 PM, Ming Lei <tom.leiming@gmail.com> wrote:
>>>
>>>  From API view, it isn't good to run all hw queues synchronously
>>> in one context, since it isn't correct for multi hw queue case.
>>>
>>> So this patch adds 'async' parameter to blk_mq_start_hw_queue(),
>>> and make blk_mq_start_hw_queues() to run hw queues asynchronously
>>> at default.
>>
>>
>> BTW, without the change, it is easy to trigger the WARN_ON() in
>> __blk_mq_run_hw_queue().
>
>
> Why not just have it call blk_mq_run_hw_queue()? Pass in async == false, but
> let the cpumask logic sort out if we need to force an async run.

That looks better, thanks.


Thanks,
-- 
Ming Lei

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

end of thread, other threads:[~2014-06-25  4:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-24 14:53 [PATCH] blk-mq: run hw queue asynchronously in blk_mq_start_hw_queues Ming Lei
2014-06-25  2:42 ` Ming Lei
2014-06-25  3:00   ` Jens Axboe
2014-06-25  4:47     ` Ming Lei

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.