* [PATCH] blk-mq: mark hctx RESTART when get budget fails
@ 2018-04-16 7:55 Jianchao Wang
2018-04-16 8:15 ` Ming Lei
0 siblings, 1 reply; 3+ messages in thread
From: Jianchao Wang @ 2018-04-16 7:55 UTC (permalink / raw)
To: axboe, ming.lei; +Cc: linux-block, linux-kernel
When get budget fails, blk_mq_sched_dispatch_requests does not do
anything to ensure the hctx to be restarted. We can survive from
this, because only the scsi implements .get_budget and it always
runs the hctx queues when request is completed.
Signed-off-by: Jianchao Wang <jianchao.w.wang@oracle.com>
---
block/blk-mq-sched.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/block/blk-mq-sched.c b/block/blk-mq-sched.c
index 25c14c5..49e7cd9 100644
--- a/block/blk-mq-sched.c
+++ b/block/blk-mq-sched.c
@@ -102,8 +102,10 @@ static void blk_mq_do_dispatch_sched(struct blk_mq_hw_ctx *hctx)
!e->type->ops.mq.has_work(hctx))
break;
- if (!blk_mq_get_dispatch_budget(hctx))
+ if (!blk_mq_get_dispatch_budget(hctx)) {
+ blk_mq_sched_mark_restart_hctx(hctx);
break;
+ }
rq = e->type->ops.mq.dispatch_request(hctx);
if (!rq) {
@@ -148,8 +150,10 @@ static void blk_mq_do_dispatch_ctx(struct blk_mq_hw_ctx *hctx)
if (!sbitmap_any_bit_set(&hctx->ctx_map))
break;
- if (!blk_mq_get_dispatch_budget(hctx))
+ if (!blk_mq_get_dispatch_budget(hctx)) {
+ blk_mq_sched_mark_restart_hctx(hctx);
break;
+ }
rq = blk_mq_dequeue_from_ctx(hctx, ctx);
if (!rq) {
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] blk-mq: mark hctx RESTART when get budget fails
2018-04-16 7:55 [PATCH] blk-mq: mark hctx RESTART when get budget fails Jianchao Wang
@ 2018-04-16 8:15 ` Ming Lei
2018-04-16 8:34 ` jianchao.wang
0 siblings, 1 reply; 3+ messages in thread
From: Ming Lei @ 2018-04-16 8:15 UTC (permalink / raw)
To: Jianchao Wang; +Cc: axboe, linux-block, linux-kernel
On Mon, Apr 16, 2018 at 03:55:36PM +0800, Jianchao Wang wrote:
> When get budget fails, blk_mq_sched_dispatch_requests does not do
> anything to ensure the hctx to be restarted. We can survive from
> this, because only the scsi implements .get_budget and it always
> runs the hctx queues when request is completed.
Exactly, that is why we don't handle the failure before dequeuing
request.
I suggest to just document this usage now.
>
> Signed-off-by: Jianchao Wang <jianchao.w.wang@oracle.com>
> ---
> block/blk-mq-sched.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/block/blk-mq-sched.c b/block/blk-mq-sched.c
> index 25c14c5..49e7cd9 100644
> --- a/block/blk-mq-sched.c
> +++ b/block/blk-mq-sched.c
> @@ -102,8 +102,10 @@ static void blk_mq_do_dispatch_sched(struct blk_mq_hw_ctx *hctx)
> !e->type->ops.mq.has_work(hctx))
> break;
>
> - if (!blk_mq_get_dispatch_budget(hctx))
> + if (!blk_mq_get_dispatch_budget(hctx)) {
> + blk_mq_sched_mark_restart_hctx(hctx);
The RESTART flag still may not take into effect if all requests are
completed before calling blk_mq_sched_mark_restart_hctx().
> break;
> + }
>
> rq = e->type->ops.mq.dispatch_request(hctx);
> if (!rq) {
> @@ -148,8 +150,10 @@ static void blk_mq_do_dispatch_ctx(struct blk_mq_hw_ctx *hctx)
> if (!sbitmap_any_bit_set(&hctx->ctx_map))
> break;
>
> - if (!blk_mq_get_dispatch_budget(hctx))
> + if (!blk_mq_get_dispatch_budget(hctx)) {
> + blk_mq_sched_mark_restart_hctx(hctx);
Same with above.
Thanks,
Ming
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] blk-mq: mark hctx RESTART when get budget fails
2018-04-16 8:15 ` Ming Lei
@ 2018-04-16 8:34 ` jianchao.wang
0 siblings, 0 replies; 3+ messages in thread
From: jianchao.wang @ 2018-04-16 8:34 UTC (permalink / raw)
To: Ming Lei; +Cc: axboe, linux-block, linux-kernel
Hi Ming
Thanks for your kindly response.
On 04/16/2018 04:15 PM, Ming Lei wrote:
>> - if (!blk_mq_get_dispatch_budget(hctx))
>> + if (!blk_mq_get_dispatch_budget(hctx)) {
>> + blk_mq_sched_mark_restart_hctx(hctx);
> The RESTART flag still may not take into effect if all requests are
> completed before calling blk_mq_sched_mark_restart_hctx().
>
Yes, this is indeed a very tricky scenario.
Sincerely
Jianchao
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-04-16 8:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-16 7:55 [PATCH] blk-mq: mark hctx RESTART when get budget fails Jianchao Wang
2018-04-16 8:15 ` Ming Lei
2018-04-16 8:34 ` jianchao.wang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox