From: Laurence Oberman <loberman@redhat.com>
To: David Jeffery <djeffery@redhat.com>, linux-block@vger.kernel.org
Subject: Re: [PATCH] blk-mq: avoid extending delays of active hctx from blk_mq_delay_run_hw_queues
Date: Tue, 01 Feb 2022 08:39:31 -0500 [thread overview]
Message-ID: <eda32e49be3d9111fe2ddeddd2155046944ec936.camel@redhat.com> (raw)
In-Reply-To: <20220131203337.GA17666@redhat>
On Mon, 2022-01-31 at 15:33 -0500, David Jeffery wrote:
> When blk_mq_delay_run_hw_queues sets an hctx to run in the future, it
> can
> reset the delay length for an already pending delayed work run_work.
> This
> creates a scenario where multiple hctx may have their queues set to
> run,
> but if one runs first and finds nothing to do, it can reset the delay
> of
> another hctx and stall the other hctx's ability to run requests.
>
> To avoid this I/O stall when an hctx's run_work is already pending,
> leave it untouched to run at its current designated time rather than
> extending its delay. The work will still run which keeps closed the
> race
> calling blk_mq_delay_run_hw_queues is needed for while also avoiding
> the
> I/O stall.
>
> Signed-off-by: David Jeffery <djeffery@redhat.com>
> ---
> block/blk-mq.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
>
> diff --git a/block/blk-mq.c b/block/blk-mq.c
> index f3bf3358a3bb..ae46eb4bf547 100644
> --- a/block/blk-mq.c
> +++ b/block/blk-mq.c
> @@ -2177,6 +2177,14 @@ void blk_mq_delay_run_hw_queues(struct
> request_queue *q, unsigned long msecs)
> queue_for_each_hw_ctx(q, hctx, i) {
> if (blk_mq_hctx_stopped(hctx))
> continue;
> + /*
> + * If there is already a run_work pending, leave the
> + * pending delay untouched. Otherwise, a hctx can stall
> + * if another hctx is re-delaying the other's work
> + * before the work executes.
> + */
> + if (delayed_work_pending(&hctx->run_work))
> + continue;
> /*
> * Dispatch from this hctx either if there's no hctx
> preferred
> * by IO scheduler or if it has requests that bypass
> the
>
Ming is aware of this patch and had asked David to submit it.
David already explained his reasoning internally.
It's for an already reported issue by a customer.
Reviewed-by:
Laurence Oberman <loberman@redhat.com>
next prev parent reply other threads:[~2022-02-01 13:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-31 20:33 [PATCH] blk-mq: avoid extending delays of active hctx from blk_mq_delay_run_hw_queues David Jeffery
2022-02-01 13:39 ` Laurence Oberman [this message]
2022-02-08 2:45 ` Ming Lei
2022-02-14 14:50 ` John Pittman
2022-02-22 14:31 ` Laurence Oberman
2022-02-17 2:48 ` Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=eda32e49be3d9111fe2ddeddd2155046944ec936.camel@redhat.com \
--to=loberman@redhat.com \
--cc=djeffery@redhat.com \
--cc=linux-block@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).